slottle
This is a simple rust library provide thread-based throttle pool. It can dynamic create multiple throttles by user given "resource id".
For example, a web scraping tool may treat domain name as resource id to control access speed of each hosts in generic way. User can create multiple pools at the same time, each one have different configurations for different situations.
Example
//! ```cargo
//! [dependencies]
//! rayon = "1.5.0"
//! slottle = "0.1.0"
//! ```
use *;
use ThrottlePool;
use ;
Output:
job 1 started, time passed: 0.000016512s
job 5 started, time passed: 0.000032532s
job 3 started, time passed: 0.005074456s
job 6 started, time passed: 0.005087911s
job 4 started, time passed: 0.010070142s
job 2 started, time passed: 0.015075837s
Please check online documents for more detail.
License
MIT