The basic idea is that the first time a klipse snippet's cljs is evaluated, we kick off a go-loop whose job is to wake up every 100ms and update watchdog-tick to say: this is the last time that i woke up!
And if (guard) gets run and notices that the watchdog hasn't been able to wake up within the last max-eval-duration milliseconds, it decides that we should kill the currently evaluating function, and does that by throwing an error.
and this doesn't kill go-loops created by users' snippet code, because those go-loops won't block the watchdog from running.
The basic idea is that the first time a klipse snippet's cljs is evaluated, we kick off a go-loop whose job is to wake up every 100ms and update *watchdog-tick* to say: this is the last time that i woke up! And if (guard) gets run and notices that the watchdog hasn't been able to wake up within the last *max-eval-duration* milliseconds, it decides that we should kill the currently evaluating function, and does that by throwing an error. and this doesn't kill go-loops created by users' snippet code, because those go-loops won't block the watchdog from running.
each time the watchdog has a chance to run, this var is set with the current time
each time the watchdog has a chance to run, this var is set with the current time
(my-emits max-eval-duration & xs)
same as cljs.compiler/emits with insertion of a guard()
call before if and recur (emitted as continue) statement.
Limitations:
same as cljs.compiler/emits with insertion of a `guard()` call before if and recur (emitted as continue) statement. Limitations: 1. It doesn't prevent infinite loop in imported code e.g. (reduce + (range)
(run-watchdog*)
reset the watchdog-tick to the current time once in a while
reset the *watchdog-tick* to the current time once in a while
The number of msec for the watchdog period. This value has to be much lower than min-max-eval-duration.
The number of msec for the watchdog period. This value has to be much lower than min-max-eval-duration.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close