(config: &Config)
| 238 | |
| 239 | impl GrpcRateLimiter { |
| 240 | pub fn from_config(config: &Config) -> Option<Self> { |
| 241 | let (requests, window) = config.grpc_rate_limit()?; |
| 242 | Some(Self { |
| 243 | requests, |
| 244 | window, |
| 245 | state: Arc::new(Mutex::new(GrpcRateLimitState { |
| 246 | window_started: Instant::now(), |
| 247 | remaining: requests, |
| 248 | })), |
| 249 | }) |
| 250 | } |
| 251 | |
| 252 | fn allow(&self) -> bool { |
| 253 | let now = Instant::now(); |
nothing calls this directly
no test coverage detected