diff --git a/src/Internal/ContextClusterWorker.php b/src/Internal/ContextClusterWorker.php index 4c96327..da26f27 100644 --- a/src/Internal/ContextClusterWorker.php +++ b/src/Internal/ContextClusterWorker.php @@ -109,7 +109,13 @@ public function run(): void }; } - $this->joinFuture->await(new TimeoutCancellation(ClusterWatcher::WORKER_TIMEOUT)); + try { + $this->joinFuture->await(new TimeoutCancellation(ClusterWatcher::WORKER_TIMEOUT)); + } catch (CancelledException) { + $this->close(); + // Give it a second to reap the result. Generally this never should time out, unless something is seriously broken. + $this->joinFuture->await(new TimeoutCancellation(1)); + } } catch (\Throwable $exception) { $this->joinFuture->ignore(); throw $exception;