From f08710e910910fc5d2289e2dfdf002795cfdff4c Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Fri, 20 Dec 2024 07:33:40 +0100 Subject: [PATCH] Report ExitFailures from cluster worker exits --- src/Internal/ContextClusterWorker.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Internal/ContextClusterWorker.php b/src/Internal/ContextClusterWorker.php index 4c96327..a0c8699 100644 --- a/src/Internal/ContextClusterWorker.php +++ b/src/Internal/ContextClusterWorker.php @@ -109,7 +109,14 @@ public function run(): void }; } - $this->joinFuture->await(new TimeoutCancellation(ClusterWatcher::WORKER_TIMEOUT)); + try { + $this->joinFuture->await(new TimeoutCancellation(ClusterWatcher::WORKER_TIMEOUT)); + } catch (CancelledException $e) { + $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)); + throw $e; + } } catch (\Throwable $exception) { $this->joinFuture->ignore(); throw $exception;