mirror of
https://github.com/bugsink/bugsink.git
synced 2026-05-19 06:38:58 -05:00
edff0e219c
Replacing it with passing the thresholds on each call to `inc`. The event-based approach was broken in a multi-process setup (such as having a separate gunicorn and snappea), because the unmute events would be registered GUI-side (gunicorn), and the single process where the counting happened had a different PC instance. The solution is to get rid of the event-listener approach, and just make an inventory of the threshold-checks that need to be done right before each call to `inc`. Because the calls to `inc` happen in a single process (we [will] enforce this elsewhere) this fixes the problem. During refactoring it became clear that this is probably a good idea anyway: many comments about corner-cases could be removed. Other things I found: * The now-removed `_digest_event_python_postprocessing` did more than Python alone (it also touched the DB for unmutes) so that was probably a separate bug (now fixed). * In the event-listener-based code, I foresaw the need for `on_become_false` (but did not use it yet). The idea was probably that this could be useful in the quota setting (a quota can become unmet after a while) but in fact it isn't useful, because when a quota becomes unmet you'd still need to check all quota and OR them. Tests have not been truly refactored (the new architecture probably points to a new desired set of tests) but rather have been made to run in the simplest way possible.