Fix race condition: reaction removal (interactivity)
Created by: Naamloos
Summary
This fixes an issue where interactivity reactions would get re-added due to the interactivityrequest class not getting removed before reactions would get removed. (This causes a race condition, re-adding reactions when really it shouldn't)
Ideally, we'd want to get this change in before the official 4.x release.
Details
Made sure TryRemove
from the requests
list is executed before DoCleanupAsync
.
Notes
- Point of discussion, suggested by emzi: we could look into bubbling up exceptions from interactivity (from what I remember, a lot of it is just getting silently ignored. Might be favorable to have users handle these themselves.)
- The try/catch/finally now has a try/catch in it's finally block to ensure
DoCleanupAsync
does not throw again after removing the request. I am not entirely sure whether that would be the best solution. Also up for discussion?