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

Fix scheduler.once() running multiple times #231

Merged
merged 1 commit into from
Jun 14, 2021

Conversation

unode
Copy link
Collaborator

@unode unode commented Jun 14, 2021

The included test executes the function 4 times.
The fix overrides should_run preventing the job from being picked up again.

The job will not be retried if it fails to execute.

@jneeven jneeven merged commit d4f78c5 into attzonko:main Jun 14, 2021
@unode unode deleted the once_scheduler branch August 14, 2021 11:02
unode added a commit to unode/mmpy_bot that referenced this pull request Aug 19, 2021
This reverts commit d4f78c5.

The same bug exists not only in schedule.once() but also
schedule.every() so a better fix is necessary.
unode added a commit to unode/mmpy_bot that referenced this pull request Aug 19, 2021
This forces code to run sequentially on the scheduler thread.

fixes attzonko#231 (again)
unode added a commit to unode/mmpy_bot that referenced this pull request Aug 19, 2021
This forces code to run sequentially on the scheduler thread.

fixes attzonko#231 (again)
unode added a commit to unode/mmpy_bot that referenced this pull request Aug 19, 2021
This forces code to run sequentially on the scheduler thread.

fixes attzonko#231 (again)
unode added a commit to unode/mmpy_bot that referenced this pull request Aug 19, 2021
This forces code to run sequentially on the scheduler thread.

fixes attzonko#231 (again)

(cherry picked from commit e393992)
attzonko pushed a commit that referenced this pull request Aug 29, 2021
* Revert "Fix scheduler.once() running multiple times (#231)"

This reverts commit d4f78c5.

The same bug exists not only in schedule.once() but also
schedule.every() so a better fix is necessary.

* Add tests to capture abnormal consecutive execution of scheduled tasks

* Test using a threadpool

The threadpool already has a dedicated thread to run scheduler tasks
which is not the same as running in the main thread.

* Disable tests that can't be fixed

* The schedule module is not designed to run in a non-blocking fashion

This forces code to run sequentially on the scheduler thread.

fixes #231 (again)
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.

2 participants