Skip to content

Commit 12c63f0

Browse files
committed
run: don't report an error in task when the run is stopped
Previously, when the run was signalled to stop, if a task fails an operation and notices that it should stop, it returned an error. Now, it doesn't, and only returns an error in case either all global retries are exhausted or an error occured more than `max_retries_per_op` times. The new semantic makes more sense. For example, if the test is stopped manually with 10 consecutive retries allowed, and there is a task which performed 5 operations and notices that it should stop, the task shouldn't return an error because it might have succeeded if it tried one more time.
1 parent 063a821 commit 12c63f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/run.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl WorkerSession {
163163
self.context.max_retries_in_total,
164164
)))
165165
}
166-
Err(err) if self.context.should_stop() => Err(err),
166+
Err(_) if self.context.should_stop() => Ok(ControlFlow::Break(())),
167167
Err(_) => {
168168
self.trial_idx += 1;
169169
Ok(ControlFlow::Continue(()))
@@ -550,7 +550,7 @@ mod tests {
550550

551551
// Ask to stop and make sure that the workload finishes
552552
ctrl.ask_to_stop();
553-
fut.await.unwrap_err();
553+
fut.await.unwrap();
554554
}
555555

556556
#[tokio::test]

0 commit comments

Comments
 (0)