From 0b6b6b440b483d1fe10b5582c251b9ac56b3fada Mon Sep 17 00:00:00 2001 From: disqualifier Date: Mon, 6 Jul 2026 19:26:31 -0400 Subject: [PATCH] fix: cooldown handout never truncates a longer active burn deadline A forced soonest-recovering handout unconditionally set timeout = now + cooldown, silently collapsing an explicit burn(proxy, 3600) to the cooldown window. Cooldown now only EXTENDS availability delay: it leaves a still-running longer timed burn untouched and never resurrects a permanent _DEAD (-1) burn into a future timestamp, while a fine proxy and a burn shorter than cooldown are cooled as before. Signed-off-by: disqualifier --- src/aioproxies/manager.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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: