missionary.core/timeout
Usage
(timeout task ms)(timeout task ms value)
An operator returning a task spawning given task. If task process terminates within ms milliseconds, timeout process terminates with this result. Otherwise, task process is cancelled and timeout process completes with value. If value is not provided, timeout process completes with nil.
Example : ensure a task terminates within 500ms
(require '[missionary.core :as m]) (def sleep-for-1-sec (m/sleep 1000 :foo)) (m/? (m/timeout sleep-for-1-sec 500 :bar)) := :bar
Synchronicity
taskspawn is synchronous withtimeoutspawntasktermination is synchronous withtimeouttermination