Skip to content
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

Drain buffered polls on shutdown #161

Merged

Conversation

Sushisource
Copy link
Member

What was changed

Buffered polls are now drained before poll returns shutdown

Why?

Avoid pointlessly timing out workflow tasks the worker has claimed while shutting down

Checklist

  1. Closes Drain buffered server responses on shutdown #160

  2. How was this tested:
    New test

  3. Any docs updates needed?

Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with some minor comments

let poll_fut = async move {
// Now poll again, which will start spinning, and buffer the next WFT with timer fired in it
// - it won't stop spinning until the first task is complete
let t = dbg!(core.poll_workflow_task(TEST_Q).await.unwrap());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is only required today because core doesn't poll without an outstanding poll request from lang.

};
tokio::join!(poll_fut, complete_first, async {
// If the shutdown is sent too too fast, we might not have got a chance to even buffer work
tokio::time::sleep(Duration::from_millis(5)).await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know my opinion on time sensitive tests like this.
We should have a better way of timing the shutdown.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #162

src/workflow/workflow_tasks/concurrency_manager.rs Outdated Show resolved Hide resolved
# Conflicts:
#	src/workflow/workflow_tasks/concurrency_manager.rs
@Sushisource Sushisource force-pushed the drain-buffered-polls-on-shutdown branch from 9d15485 to 1aa18f8 Compare August 6, 2021 21:40
* Fixes resultant hang in test
* A whole bunch of refactoring to expose worker options in test code
  to test that
@Sushisource Sushisource force-pushed the drain-buffered-polls-on-shutdown branch from bb1ad3a to 2c83e6b Compare August 7, 2021 01:14
@Sushisource Sushisource enabled auto-merge (squash) August 7, 2021 01:15
@Sushisource Sushisource merged commit 129ce31 into temporalio:master Aug 8, 2021
@Sushisource Sushisource deleted the drain-buffered-polls-on-shutdown branch August 8, 2021 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drain buffered server responses on shutdown
2 participants