aroemers / mount-lite

mount, but different and light
https://cljdoc.org/d/functionalbytes/mount-lite/
Eclipse Public License 1.0
102 stars 8 forks source link

Sessions don't play well with futures and agents #22

Closed robhanlon22 closed 1 year ago

robhanlon22 commented 3 years ago

I've been running into an issue where a library I use internally spawns a future which eventually calls back into my application code. Since futures are run on a thread pool initialized by Clojure, they lose the value of the inheritable thread local and are thus unable to tell which session they're associated with. It seems like a way to handle this would be to use a binding rather than a new Thread in with-session, and perhaps provide a function that could be used to convey the session to new threads.

aroemers commented 1 year ago

This is indeed a documentend known issue. A binding would have the same issue. The (unfinished) 3.x branch has a proper solution for this.