sdk-typescript icon indicating copy to clipboard operation
sdk-typescript copied to clipboard

Warn on unfinished handlers and provide `workflow.allHandlersFinished()` API

Open dandavison opened this issue 1 year ago • 2 comments

Fixes #1434.

  • new workflow API to wait for all signal and update handlers to be finished: await workflow.condition(() => workflow.allHandlersFinished())
  • By default, warn when workflow exits with unfinished handlers, but not when a handler finishes due to workflow cancellation or workflow failure.
  • Warnings controlled by HandlerUnfinishedPolicy

dandavison avatar Jul 08 '24 22:07 dandavison

I'm concerned with allHandlersFinished returning true between handling of a signal and an update.

@bergundy and I discussed this. There is indeed a bug, though not introduced in this PR and therefore not blocking this PR. We've opened https://github.com/temporalio/sdk-typescript/issues/1474

dandavison avatar Jul 24 '24 15:07 dandavison

Should also close https://github.com/temporalio/sdk-typescript/issues/1435

Sushisource avatar Jul 30 '24 16:07 Sushisource

Thanks very much for reviewing @mjameswh!

Still a few nits, but I'm ok to fix those in a follow-up PR.

The only thing I've pushed to a follow-up is the task of generating example stack traces to review our use of untrackPromise: https://github.com/temporalio/sdk-typescript/issues/1486, which was needed even before this PR.

dandavison avatar Aug 07 '24 11:08 dandavison