-
Notifications
You must be signed in to change notification settings - Fork 69
removed time.sleep and using ticker instead #648
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
Conversation
Signed-off-by: Nir Rozenbaum <[email protected]>
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/lgtm Thanks! |
/hold |
make sure refresh internal is valid at the ticker creation time Signed-off-by: Nir Rozenbaum <[email protected]>
once ticker was introduced instead of sleep, having 0 as the refresh internal is not valid. Signed-off-by: Nir Rozenbaum <[email protected]>
8f85b40
to
6afa145
Compare
…ly on the values. up until now, the metrics go routine ran in tests with time.Sleep(0), which means metrics were avaiable immediately. while in tests in might be acceptable to wait few seconds using sleep, in the actual code (not tests) it's a bad practice to use sleep which was replaced with a ticker (to perform periodic task in an endless loop). Signed-off-by: Nir Rozenbaum <[email protected]>
6afa145
to
926260a
Compare
/lgtm |
/retest |
/unhold |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, liu-cong, nirrozenbaum The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fix #647.
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.