1
0
mirror of https://github.com/osmarks/autobotrobot synced 2024-12-21 22:10:27 +00:00

failover mechanism got stuck, oops

This commit is contained in:
osmarks 2024-10-21 20:40:23 +01:00
parent dd3776ea1e
commit ea7fac4274

View File

@ -378,7 +378,7 @@ async def generate(sess: aiohttp.ClientSession, prompt, stop=["\n"]):
# high to low
def sort_key(backend):
failure_stats = last_failures[backend["url"]]
return (failure_stats.avoid_until is None or failure_stats.avoid_until < now), -failure_stats.consecutive_failures, backend["priority"]
return (failure_stats.avoid_until is None or failure_stats.avoid_until < now), backend["priority"], -failure_stats.consecutive_failures
backends = sorted(backends, key=sort_key, reverse=True)