Use `after-seconds` in supervise.rkt
This commit is contained in:
parent
b59197f94b
commit
4ba9eee1c7
|
@ -7,8 +7,6 @@
|
|||
|
||||
default-restart-strategy)
|
||||
|
||||
(require syndicate/driver-support)
|
||||
|
||||
(define-logger syndicate/supervise)
|
||||
|
||||
(define-syntax-rule (supervise (main-proc-name arg ...))
|
||||
|
@ -27,10 +25,6 @@
|
|||
(spawn/link #:name (list 'supervised main-proc-name) (main-proc))))
|
||||
|
||||
(define ((default-restart-strategy [timeout-seconds 5] [plus-or-minus 1]) restart)
|
||||
(react
|
||||
(linked-thread
|
||||
(lambda (facet)
|
||||
(define t (+ timeout-seconds (* plus-or-minus (- (random) 0.5) 2)))
|
||||
(log-syndicate/supervise-debug "restarting in ~v seconds" t)
|
||||
(sleep t)
|
||||
(turn! facet (lambda () (on-stop (restart))))))))
|
||||
(define t (+ timeout-seconds (* plus-or-minus (- (random) 0.5) 2)))
|
||||
(log-syndicate/supervise-debug "restarting in ~v seconds" t)
|
||||
(after-seconds t (restart)))
|
||||
|
|
Loading…
Reference in New Issue