[Feature] Allow disabling thread pool shutdown
solonovamax opened this issue ยท 4 comments
It would be nice if you could disable the shutdown of the thread pool.
Because for some bots that send a lot of webhooks in many servers, it might be of interest to provide their own custom thread pool as opposed to constantly creating a new one. The only problem is, with the current implementation, the thread pool is always shut down when the webhook client is shut down.
Might PR with changes, since this is pretty simple & easy to do.
You can just not shutdown the webhook client, since that shutdown only stops the thread-pool anyway.
Will it get GC'ed if I don't shut it down?
The GC will collect it unless any thread keeps a reference. Pools used by the webhook client only keep a reference when there is a task queued. So if the entire queue is empty, and none of your threads have a reference to the client, it should be collected without shutting down the pool.
Sick, I'll do that then.
It also kinda resolves my other issue that I had with the library I was using to cache things lol