-
Notifications
You must be signed in to change notification settings - Fork 79
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
Run event loop after job application #717
base: main
Are you sure you want to change the base?
Conversation
71b3ca3
to
3d74ddf
Compare
3d74ddf
to
a901b4d
Compare
# Ensure the main workflow function task is initialized after a first run of the | ||
# event loop, which might execute before-start signals/updates. This is behind | ||
# a finally because if those handlers fail, we need still need the main routine | ||
# to be initialized in order to fail tasks properly. |
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.
If it weren't for this bit we would've ended up with net-less code here. A bit too bad, but, I think still nicer than grouping things into batches.
c292f59
to
53462cc
Compare
53462cc
to
cac670c
Compare
self.events.append("act-2") | ||
|
||
|
||
async def test_async_loop_ordering(client: Client): |
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.
Hrmm, I think another test may look like this:
- Create workflow that has a signal handler that updates some counter and an activity in the background that, when done, updates that same counter. And have the primary workflow method return the counter when it is
> 2
(i.e. after wait condition for that). - Start the workflow, and while the activity is running, kill the workflow worker
- While the workflow worker is not running, send two signals and complete the activity
- Start the workflow worker again and confirm result and confirm that all three of those items (the two signals and the activity completion) came in the same workflow task/activation.
I think with older code, the counter will only reach 2
before workflow returns (i.e. the two signals), but this newer code may return 3
(because it completed the activity before it processed wait condition). I have not tested this though.
What was changed
Run the event loop after applying all jobs, rather than after each "batch" of jobs.
Why?
Align with TS & Core's intended method of job application
Checklist
Closes [Feature Request] Consider aligning activation job application with TS changes #606
How was this tested:
Existing & new tests
Any docs updates needed?