Skip to content
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

Avoid retrieving a worker which is being removed by the idle worker clean-up process #3725

Merged
merged 9 commits into from
Dec 14, 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Avoid retrieving a worker which is being removed by the idle worker clean-up
process.
process ([\#3703](https://github.com/informalsystems/hermes/issues/3703))
12 changes: 11 additions & 1 deletion crates/relayer/src/worker/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,17 @@ impl WorkerMap {
config: &Config,
) -> &WorkerHandle {
if self.workers.contains_key(&object) {
&self.workers[&object]
if self.workers[&object].shutdown_stopped_tasks() {
self.remove_stopped(
self.workers[&object].id(),
self.workers[&object].object().clone(),
);

let worker = self.spawn_worker(src, dst, &object, config);
self.workers.entry(object).or_insert(worker)
} else {
&self.workers[&object]
}
} else {
let worker = self.spawn_worker(src, dst, &object, config);
self.workers.entry(object).or_insert(worker)
Expand Down
Loading