This commit is contained in:
Bryan Stitt 2023-10-07 14:26:10 -07:00
parent 2d6daf4def
commit 580f4c1865

View File

@ -176,20 +176,19 @@ impl OpenRequestHandle {
self.rpc.clone() self.rpc.clone()
} }
pub fn rate_limit_for(&self, x: Duration) { pub fn rate_limit_for(&self, duration: Duration) {
// TODO: we actually only want to send if our value is greater
if self.rpc.backup { if self.rpc.backup {
debug!(?x, "rate limited on {}!", self.rpc); debug!(?duration, "rate limited on {}!", self.rpc);
} else { } else {
warn!(?x, "rate limited on {}!", self.rpc); warn!(?duration, "rate limited on {}!", self.rpc);
} }
// TODO: use send_if_modified to be sure we only send if our value is greater
self.rpc self.rpc
.hard_limit_until .hard_limit_until
.as_ref() .as_ref()
.unwrap() .unwrap()
.send_replace(Instant::now() + x); .send_replace(Instant::now() + duration);
} }
/// Just get the response from the provider without any extra handling. /// Just get the response from the provider without any extra handling.