mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-26 19:42:46 +02:00
2d6b1131ac
The companion queue's capacity path ran a Python loop of single-row SELECT+DELETE pairs ordered by created_at. Wall-clock ordering meant a backwards clock step (NTP correction) could make the just-inserted channel row sort as oldest and wrongly reject the incoming message while older channel rows remained evictable. Replace the loop with one set-based DELETE ordered by id (AUTOINCREMENT, i.e. insertion order, immune to clock steps), with an evictable-count pre-check preserving the all-or-nothing rejection rule: never displace a direct message, never evict the incoming row to make room for itself, roll back the insert entirely when channel rows cannot make room. The queue load and pop queries move to id ordering for the same reason.