-
Notifications
You must be signed in to change notification settings - Fork 0
Throttle worker retries in tests #49
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
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 |
|---|---|---|
|
|
@@ -334,7 +334,8 @@ mod tests { | |
| async fn setup_run_worker(status: u16) -> (MockServer, Arc<Config>, Receiver, Arc<Octocrab>) { | ||
| let dir = tempdir().expect("tempdir"); | ||
| let cfg = Arc::new(Config { | ||
| cooldown_period_seconds: 0, | ||
| // Use a positive cooldown to ensure retries are throttled. | ||
| cooldown_period_seconds: 1, | ||
| ..temp_config(&dir) | ||
|
Comment on lines
+337
to
339
Contributor
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. 🧹 Nitpick (assertive) Use a sub-second cooldown to avoid lengthening the test suite Setting -cooldown_period_seconds: 1,
+cooldown_period_seconds: 0, // keep struct value
+// …
+tokio::time::sleep(Duration::from_millis(5)).await; // apply during test onlyor keep the field but assign
🤖 Prompt for AI Agents |
||
| }); | ||
| let (mut sender, rx) = channel(&cfg.queue_path).expect("channel"); | ||
|
|
@@ -352,7 +353,12 @@ mod tests { | |
| let server = MockServer::start().await; | ||
| Mock::given(method("POST")) | ||
| .and(path("/repos/o/r/issues/1/comments")) | ||
| .respond_with(ResponseTemplate::new(status).set_body_raw("{}", "application/json")) | ||
| .respond_with( | ||
| ResponseTemplate::new(status).set_body_json(&serde_json::json!({ | ||
| "id": 1, | ||
| "body": "b", | ||
| })), | ||
| ) | ||
| .mount(&server) | ||
| .await; | ||
|
|
||
|
|
||
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.
🧹 Nitpick (assertive)
Eliminate or justify the duplicated test run
make testis now executed in this “Test Only” step and (implicitly) again inside the “Test and Measure Coverage” step. Running the full suite twice:• adds several minutes to CI wall-clock time,
• recompiles the crate graph twice (different rustc flags → cache miss),
• burns extra GitHub Actions minutes.
If the intention is a fail-fast guard, either (a) drop test execution from the coverage action or (b) gate this step behind a condition (e.g. only on PRs) to avoid the double run on
main. Provide a comment explaining the rationale so future maintainers do not treat it as accidental.🤖 Prompt for AI Agents