-
Notifications
You must be signed in to change notification settings - Fork 33
Only increment counts when we acknowledge #372
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,22 +57,32 @@ def record_warning(type, attributes) | |
| end | ||
|
|
||
| def record_error(id, payload, stats: nil) | ||
| acknowledged, _ = redis.pipelined do |pipeline| | ||
| @queue.acknowledge(id, error: payload, pipeline: pipeline) | ||
| record_stats(stats, pipeline: pipeline) | ||
| acknowledged = @queue.acknowledge(id, error: payload) | ||
|
|
||
| if acknowledged | ||
| # if another worker already acknowledged the test, we don't need to update the global stats or increment the test failed count | ||
| record_stats(stats) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only record stats on failure if this worker actually acknowledged |
||
| @queue.increment_test_failed | ||
| else | ||
| record_stats({"ignored" => 1}) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't love just updating |
||
| end | ||
|
|
||
| @queue.increment_test_failed if acknowledged == 1 | ||
| nil | ||
| end | ||
|
|
||
| def record_success(id, stats: nil, skip_flaky_record: false) | ||
| _, error_reports_deleted_count, requeued_count, _ = redis.multi do |transaction| | ||
| acknowledged, error_reports_deleted_count, requeued_count, _ = redis.multi do |transaction| | ||
| @queue.acknowledge(id, pipeline: transaction) | ||
| transaction.hdel(key('error-reports'), id) | ||
| transaction.hget(key('requeues-count'), id) | ||
| record_stats(stats, pipeline: transaction) | ||
| end | ||
|
|
||
| # if another worker already acknowledged the test, we don't need to update the global stats or increment the test failed count | ||
| if acknowledged | ||
| record_stats(stats) | ||
| else | ||
| record_stats({"ignored" => 1}) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't love just updating |
||
| end | ||
|
|
||
| record_flaky(id) if !skip_flaky_record && (error_reports_deleted_count.to_i > 0 || requeued_count.to_i > 0) | ||
| nil | ||
| end | ||
|
|
||
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.
@ChrisBr Do we still need to move the counting to after recording?
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.
No because we only count on acknowledge. Counting / success requeue always is fine, errors are problematic.