MCPcopy Create free account
hub / github.com/erans/pgsqlite / check_request

Method check_request

src/protocol/rate_limiter.rs:348–366  ·  view source on GitHub ↗

Check if a request should be allowed

(&self, client_ip: Option<IpAddr>)

Source from the content-addressed store, hash-verified

346
347 /// Check if a request should be allowed
348 pub fn check_request(&self, client_ip: Option<IpAddr>) -> Result<(), RateLimitError> {
349 // First check circuit breaker
350 if self.circuit_config.enabled {
351 self.check_circuit_breaker()?;
352 }
353
354 // Then check rate limits
355 self.check_rate_limits(client_ip)?;
356
357 // Record successful request for circuit breaker
358 if self.circuit_config.enabled {
359 self.record_success();
360 }
361
362 // Cleanup old entries periodically
363 self.maybe_cleanup();
364
365 Ok(())
366 }
367
368 /// Record a request failure for circuit breaker
369 pub fn record_failure(&self) {

Callers 1

check_global_rate_limitFunction · 0.80

Calls 4

check_circuit_breakerMethod · 0.80
check_rate_limitsMethod · 0.80
record_successMethod · 0.80
maybe_cleanupMethod · 0.45

Tested by

no test coverage detected