mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-17 23:52:29 +00:00
Critical: last round's fence-flush fix (keep the queue in the map while draining) turned into an infinite loop because every shifted event went back through chatEventHandler's fence-check branch and was re-queued into the same queue we were trying to drain. Mark each flushed event `_replayed = true` before dispatch so the chatEventHandler fence-buffering branch short-circuits. Re-entrancy ordering is still preserved: live frames arriving during an await inside a flushed-event's handler still don't carry `_replayed` and continue to buffer into the same queue, staying ordered after the current flush batch. Warning: under sustained Redis slowness every emit was paying 100ms on INCR and another 100ms on XADD+EXPIRE, so live token delivery could stall 200ms/frame during an outage. Added a module-level circuit breaker that trips after 3 consecutive failures/timeouts and short-circuits the hot-path Redis calls for a 10s cooldown window. First successful call after cooldown resets the counter. Replay reads deliberately bypass the breaker because they're user-initiated and worth the slower timeout. |
||
|---|---|---|
| .. | ||
| data | ||
| internal | ||
| migrations | ||
| models | ||
| retrieval | ||
| routers | ||
| socket | ||
| static | ||
| storage | ||
| test | ||
| tools | ||
| utils | ||
| __init__.py | ||
| alembic.ini | ||
| config.py | ||
| constants.py | ||
| env.py | ||
| functions.py | ||
| main.py | ||
| tasks.py | ||