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.
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 inwith-session
, and perhaps provide a function that could be used to convey the session to new threads.