sfackler/r2d2

r2d2 threads remain alive for up to 30s after pool shutdown

arthurprs opened this issue · 2 comments

Due to the way scheduled-thread-pool word and the usage of the reaper r2d2 threads remain around for up to 30s (the non-configurable reaper period).

I looked it up and it didn't look trivial to fix.

Even if we hold the job handle and reaper_job.cancel() on drop, that won't wake up the waiting thread, as cancel is just an atomic flag.

Is there at least a way to wait until all threads are stopped? I drop connection pool, but then I don't know how long should I wait until database files are released so I can move them on Windows.

Looks like #74 was an attempt to shorten this timeout.