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

code is using time.Sleep when doing periodic task #647

Closed
nirrozenbaum opened this issue Apr 3, 2025 · 0 comments · Fixed by #648
Closed

code is using time.Sleep when doing periodic task #647

nirrozenbaum opened this issue Apr 3, 2025 · 0 comments · Fixed by #648

Comments

@nirrozenbaum
Copy link
Contributor

in some places in the code, there is a periodic task needs to be executed and the code is using time.sleep which is a bad practice.
for example, time.sleep may cause delays when receiving SIGTERM - if the go routine started the sleep section we will need to wait until sleep competes and only then the go routine will exist (due to context close).

the Go way for doing periodic task endlessly (until a cancel/close is received) is by using ticker.

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 a pull request may close this issue.

1 participant