Minor refactoring
This commit is contained in:
parent
165a35a471
commit
f6cb3282bd
|
@ -14,6 +14,13 @@
|
|||
(require "../private/util.rkt")
|
||||
(require "../protocol.rkt")
|
||||
|
||||
(define (set-minimum xs)
|
||||
(for/fold [(i #f)] [(candidate (in-set xs))]
|
||||
(cond [(not candidate) i]
|
||||
[(not i) candidate]
|
||||
[(< candidate i) candidate]
|
||||
[else i])))
|
||||
|
||||
(define (remote-topic-main full-topic)
|
||||
(define sub-id (random-hex-string 16))
|
||||
(log-info "Remote sub endpoint ~a" sub-id)
|
||||
|
@ -29,10 +36,7 @@
|
|||
(define/query-set poll-intervals (topic-demand full-topic $i) i)
|
||||
(define/query-config min-poll-interval 60)
|
||||
(begin/dataflow
|
||||
(define candidate (for/fold [(i #f)] [(candidate (in-set (poll-intervals)))]
|
||||
(cond [(not i) candidate]
|
||||
[(< candidate i) candidate]
|
||||
[else i])))
|
||||
(define candidate (set-minimum (poll-intervals)))
|
||||
(poll-interval-seconds (and candidate (max candidate (min-poll-interval)))))
|
||||
(begin/dataflow
|
||||
(log-info "Poll interval for ~a is now ~a"
|
||||
|
|
Loading…
Reference in New Issue