Skip to main content

A backported ThreadPoolExecutor with thread TTL

Project description

This library tries to solve my issue with 1000+ idle threads in Python 3.7 by using a backported ThreadPoolExecutor (with thread reuse) and giving threads a TTL.

There is probably no reason to use this for short-lived threads.

Usage

There are two ways to use this library, overwrite the default TheadPoolExecutor or use it directly.

To overwrite the default, do this as the first thing before any other thing your project does.

from timeoutthreadpoolexecutor import TimeoutThreadPoolExecutor
from concurrent.futures import thread
thread.ThreadPoolExecutor = TimeoutThreadPoolExecutor

or

from timeoutthreadpoolexecutor import TimeoutThreadPoolExecutor as ThreadPoolExecutor

License

Same as Python, I guess.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for timeoutthreadpoolexecutor, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size timeoutthreadpoolexecutor-1.0.2-py3-none-any.whl (5.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page