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 <dev@disqualifier.me>
This commit is contained in:
@@ -190,7 +190,17 @@ class AioProxies:
|
|||||||
state = self._state[proxy.key()]
|
state = self._state[proxy.key()]
|
||||||
state["uses"] = int(state["uses"]) + 1
|
state["uses"] = int(state["uses"]) + 1
|
||||||
if self.cooldown > 0:
|
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
|
return proxy
|
||||||
|
|
||||||
def _has_burned(self) -> bool:
|
def _has_burned(self) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user