We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5122002 commit 153bc00Copy full SHA for 153bc00
token-lending/sdk/src/state/rate_limiter.rs
@@ -49,7 +49,12 @@ impl Default for RateLimiterConfig {
49
impl RateLimiter {
50
/// initialize rate limiter
51
pub fn new(config: RateLimiterConfig, cur_slot: u64) -> Self {
52
- let slot_start = cur_slot / config.window_duration * config.window_duration;
+ let slot_start = if config.window_duration != 0 {
53
+ cur_slot / config.window_duration * config.window_duration
54
+ } else {
55
+ cur_slot
56
+ };
57
+
58
Self {
59
config,
60
prev_qty: Decimal::zero(),
0 commit comments