(lay-off-worker!)
Lays off the last worker in the queue. Bad luck on its part.
To 'lay off' a worker, we cannot simply send a KILL message, otherwise the worker may die without finishing its workload (e.g. if it's in the middle of playing a score). We want the worker to finish what it's doing and then shut down.
To do this, we...
Once the worker is out of the queue and we aren't letting it back in, the worker will stop getting heartbeats from the server and shut itself down.
Lays off the last worker in the queue. Bad luck on its part. To 'lay off' a worker, we cannot simply send a KILL message, otherwise the worker may die without finishing its workload (e.g. if it's in the middle of playing a score). We want the worker to finish what it's doing and then shut down. To do this, we... - remove it from the queue - temporarily 'blacklist' its address so it won't be re-queued the next time it sends a heartbeat - in a separate thread, wait a safe amount of time and then remove the address from the blacklist; this is to keep the blacklist from growing too big over time Once the worker is out of the queue and we aren't letting it back in, the worker will stop getting heartbeats from the server and shut itself down.
(supervise-workers! port desired)
Ensures that there are at least desired
number of workers available by
counting how many we have and starting more if needed.
Ensures that there are at least `desired` number of workers available by counting how many we have and starting more if needed.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close