From 99db62631519918663f4754f93ebf6bba7ddd6a8 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Fri, 10 Sep 2021 23:26:15 +0900 Subject: monitoring: Change heartbeat procedure to syntax. --- tojo-tokyo/monitoring.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tojo-tokyo/monitoring.scm') diff --git a/tojo-tokyo/monitoring.scm b/tojo-tokyo/monitoring.scm index ad5d34e..7d55dda 100644 --- a/tojo-tokyo/monitoring.scm +++ b/tojo-tokyo/monitoring.scm @@ -55,5 +55,9 @@ (string=? (substring fs 0 5) "/dev/")))) (df)))) -(define-public (heartbeat) - (http-request (current-heartbeat-url))) +(define-syntax-rule (heartbeat ((p? body ...) ...)) + (let ((heartbeat-cancel? #f)) + (when p? body ... (set! heartbeat-cancel? #t))) ... + (unless heartbeat-cancel? + (http-request (current-heartbeat-url)))) +(export-syntax heartbeat) -- cgit v1.2.3