Create a new throttling state.
(now: &NowFn)
| 388 | impl ThrottlingState { |
| 389 | /// Create a new throttling state. |
| 390 | pub fn new(now: &NowFn) -> Self { |
| 391 | Self { |
| 392 | inner: Mutex::new(ThrottlingStateInner { |
| 393 | tokens: 0, |
| 394 | last_logged_ts_seconds: now() / 1000, |
| 395 | }), |
| 396 | throttled_count: std::sync::atomic::AtomicUsize::new(0), |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | /// Check if we need to drop a statement due to throttling, and update the number of available |
| 401 | /// tokens appropriately. |
nothing calls this directly
no test coverage detected