-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command persistence now will purge NextAwaiter state store #92
command persistence now will purge NextAwaiter state store #92
Conversation
@@ -520,10 +527,12 @@ export const createMachineRunnerInternal = < | |||
|
|||
emitter.on('next', nva.push) | |||
emitter.on('failure', nva.fail) | |||
emitter.on('commandPersisted', nva.purge) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this might have been a misunderstanding or I might miss something: my understanding was that
someState.commands().someCommand()
should directly purge the awaiter state; I didn’t think that we need to wait until persistence is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially thought that too, but then I thought purge
should happen only when an event has been published.
When the swarm protocol is linear, this event publishing will be a key to the continuation of it;
there is a higher guarantee that a next-triggering state change will happen, either triggered by the published event in question or a peer reacting to said event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that’s a good point, thanks for the explanation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, apart from the Promise ordering thingy.
@@ -520,10 +527,12 @@ export const createMachineRunnerInternal = < | |||
|
|||
emitter.on('next', nva.push) | |||
emitter.on('failure', nva.fail) | |||
emitter.on('commandPersisted', nva.purge) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that’s a good point, thanks for the explanation!
let nextOrPeekTriggered = false | ||
const peek = machine.peekNext() | ||
const next = machine.next() | ||
Promise.race([peek, next]).finally(() => (nextOrPeekTriggered = true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as we discussed yesterday, which is probably in many other tests as well: after this line we need
await Promise.resolve()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes. await r1.eventRoundtrip.waitAllDone()
was below this line; I moved it up, forgetting that it is important down there too.
6e8fd26
to
1d23910
Compare
1d23910
to
785f4db
Compare
No description provided.