diff --git a/src/aioproxies/manager.py b/src/aioproxies/manager.py index 0774ff4..ede0cf1 100644 --- a/src/aioproxies/manager.py +++ b/src/aioproxies/manager.py @@ -190,7 +190,17 @@ class AioProxies: state = self._state[proxy.key()] state["uses"] = int(state["uses"]) + 1 if self.cooldown > 0: - state["timeout"] = int(now) + self.cooldown + # cooldown only ever EXTENDS availability delay - never shorten a longer + # active timeout (a still-running timed burn) down to now+cooldown. _DEAD + # (-1) is a permanent burn and must not be resurrected into a future ts. + cooled = int(now) + self.cooldown + current = state["timeout"] + if current == _DEAD: + pass + elif isinstance(current, (int, float)) and current > cooled: + pass + else: + state["timeout"] = cooled return proxy def _has_burned(self) -> bool: