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

Generalize "Work yields every N ms while waiting" pattern #2519

Closed
marta-lokhova opened this issue May 5, 2020 · 1 comment · Fixed by #2854
Closed

Generalize "Work yields every N ms while waiting" pattern #2519

marta-lokhova opened this issue May 5, 2020 · 1 comment · Fixed by #2854
Assignees
Projects

Comments

@marta-lokhova
Copy link
Contributor

Currently, there are multiple places in the code (ResolveSnapshotWork, GenerateBucketsWork, ConditionalWork) that implement the same pattern: run, check if ready, sleep for a short time, then wake self up (done via creating a weak pointer, initializing a lambda to wake self up, then setting up a timer to wait). We should avoid the duplication, and generalize this. For example, we already have wakeSelfUpCallback in BasicWork that can be used. Also, as this pattern seems useful, it might make sense to make it a feature of BasicWork.

@MonsieurNicolas
Copy link
Contributor

I agree, this could be a simple helper added at the BasicWork layer

@marta-lokhova marta-lokhova self-assigned this Dec 22, 2020
@MonsieurNicolas MonsieurNicolas added this to To do in v15.2.0 via automation Jan 5, 2021
@MonsieurNicolas MonsieurNicolas moved this from To do to In progress in v15.2.0 Jan 11, 2021
v15.2.0 automation moved this from In progress to Done Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants