This is a possibly temporary solution to the background realization of delayed resources. Each background-resource-map uses the same global (currently unbounded) thread pool, but aims for utilizing only two threads at a time to realize resources in order of priority as determined by an arbitrary selector function passed in.
This is a possibly temporary solution to the background realization of delayed resources. Each background-resource-map uses the same global (currently unbounded) thread pool, but aims for utilizing only two threads at a time to realize resources in order of priority as determined by an arbitrary selector function passed in.
(background-resource-map select-fn)
select-fn is expected to take a map of tag->delay and return the MapEntry chosen to be realized next.
select-fn is expected to take a map of tag->delay and return the MapEntry chosen to be realized next.
(enqueue-background-update resource-map dq tag f & args)
Essentially a wrapper over delay-queue/enqueue-update to enable the magic.
Essentially a wrapper over delay-queue/enqueue-update to enable the magic.
(get-next! select-fn tag->delay)
Like a swap!, but doesn't return the new value of the atom. Instead returns the thing selected and dissoced from the map.
Like a swap!, but doesn't return the new value of the atom. Instead returns the thing selected and dissoced from the map.
(realize-next-resource resource-map)
Tries to select a new delay to realize. If it realizes one, it returns true; otherwise nil.
Tries to select a new delay to realize. If it realizes one, it returns true; otherwise nil.
(thread-flow resource-map)
Try to realize-next-resource; if that returns true, repeat; otherwise, exit. In the event that an exception is caught, it logs it at warn-level and exits.
Try to realize-next-resource; if that returns true, repeat; otherwise, exit. In the event that an exception is caught, it logs it at warn-level and exits.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close