From d07e309566cec93aa9f630bd4558ae464c37ad3a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 24 Nov 2025 17:06:27 +0000 Subject: [PATCH] Fix a bug with resource pool idle checking The fiber would never finish. --- knots/resource-pool.scm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/knots/resource-pool.scm b/knots/resource-pool.scm index 301abbd..2efbeab 100644 --- a/knots/resource-pool.scm +++ b/knots/resource-pool.scm @@ -1178,9 +1178,16 @@ (when idle-seconds (spawn-fiber (lambda () - (while #t - (sleep idle-seconds) - (put-message channel '(check-for-idle-resources)))))) + (let loop () + (put-message channel '(check-for-idle-resources)) + (when (choice-operation + (wrap-operation + (sleep-operation idle-seconds) + (const #t)) + (wrap-operation + (wait-operation destroy-condition) + (const #f))) + (loop)))))) (with-exception-handler (lambda (exn)