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

introduce IntervalTimer and use it instead of threading.Timer #452

Closed
wants to merge 2 commits into from

Conversation

beniwohli
Copy link
Contributor

threading.Timer only runs the function once, and then stops the thread.
To get an interval timer, we used to start a new thread when the original
thread expired. This is wasteful, and in the worst case can lead to
runoff creation of timer threads (#450).

Instead, the IntervalTimer will run in an endless loop, executing the
given function every n seconds.

`threading.Timer` only runs the function once, and then stops the thread.
To get an interval timer, we used to start a new thread when the original
thread expired. This is wasteful, and in the worst case can lead to
runoff creation of timer threads (elastic#450).

Instead, the `IntervalTimer` will run in an endless loop, executing the
given function every n seconds.
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Looks good!

@beniwohli
Copy link
Contributor Author

closed in 5337c43

@beniwohli beniwohli closed this Apr 9, 2019
@beniwohli beniwohli deleted the reuse-timer-thread branch April 9, 2019 12:24
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