-
Notifications
You must be signed in to change notification settings - Fork 124
Warn on unfinished handlers and provide workflow.allHandlersFinished()
API
#1459
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
Warn on unfinished handlers and provide workflow.allHandlersFinished()
API
#1459
Conversation
4f6f7aa
to
1a48acf
Compare
6fd42a4
to
ae386a1
Compare
ae386a1
to
f7cddea
Compare
packages/test/src/test-integration-workflows-with-recorded-logs.ts
Outdated
Show resolved
Hide resolved
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'm concerned with allHandlersFinished
returning true
between handling of a signal and an update.
I noticed that updates aren't reordered an put in the first activation batch:
const [signals, nonSignals] = partition(nonPatches, ({ signalWorkflow }) => signalWorkflow != null); |
This means that this workflow won't get a chance to see an update:
import * as workflow from '@temporalio/workflow';
const fooSignal = workflow.defineSignal('foo');
const fooUpdate = workflow.defineUpdate('foo');
export async function http(): Promise<string> {
var numFoos = 0;
workflow.setHandler(fooSignal, () => {
numFoos++
});
workflow.setHandler(fooUpdate, () => {
numFoos++
});
await workflow.condition(workflow.allHandlersFinished);
return `foos: ${numFoos}`;
}
Starter:
const handle = await client.workflow.start(workflowType, {
workflowId,
taskQueue: 'test',
args,
});
await handle.signal('foo');
await handle.startUpdate('foo', {
waitForStage: WorkflowUpdateStage.ACCEPTED,
});
Fixing this would require to break history compatibility or find a safe way to patch outside of the sandbox, which we haven't done before.
f7cddea
to
20337f9
Compare
Should also close #1435 |
2e61590
to
3f4dbce
Compare
4b1f1db
to
db05355
Compare
3b7eb2a
to
f3ce8a1
Compare
… from cancellation
f3ce8a1
to
5d4caca
Compare
a363551
to
53a9ba5
Compare
I initially thought we should keep it to make the documentation maximally approachable, but I'm going back on that now.
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.
Still a few nits, but I'm ok to fix those in a follow-up PR.
77240fe
to
6fdbd32
Compare
Fixes #1434 and #1435.
await workflow.condition(() => workflow.allHandlersFinished())
HandlerUnfinishedPolicy