-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Normalize the job queue latency's value #21355
base: main
Are you sure you want to change the base?
Conversation
fix goharbor#21354 Signed-off-by: stonezdj <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #21355 +/- ##
==========================================
+ Coverage 45.36% 46.27% +0.91%
==========================================
Files 244 247 +3
Lines 13333 13883 +550
Branches 2719 2875 +156
==========================================
+ Hits 6049 6425 +376
- Misses 6983 7121 +138
- Partials 301 337 +36
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -267,10 +267,15 @@ func (w *monitorController) ListQueues(ctx context.Context) ([]*jm.Queue, error) | |||
if skippedUnusedJobType(queue.JobName) { | |||
continue | |||
} | |||
// normalize latency, it sometimes return -1 | |||
var latency int64 | |||
if queue.Latency > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pause this PR for further discussion.
Personally, I don't think changing the negative number to 0 is the right approach. The latency should always be positive, and a negative value typically indicates a misconfiguration, such as when the system time on the worker node running harbor-core and harbor-jobservice are not synchronized with the same time server.
Adjusting the value to 0 might mask the underlying issue for the administrator. I prefer that we add a debug log to help identify the potential cause of this situation.
fix #21354
Thank you for contributing to Harbor!
Comprehensive Summary of your change
Issue being fixed
Fixes #(issue)
Please indicate you've done the following: