diff options
| author | 2020-09-20 12:17:30 +0200 | |
|---|---|---|
| committer | 2020-09-20 12:53:03 +0200 | |
| commit | d68d6d2858b8df74c48c00c0af23de24aa5022dc (patch) | |
| tree | 39917bcb7f4b977a3ff077d5f850a4fc83ff1ba8 /tests | |
| parent | Add channel blacklist for duckpond (diff) | |
Fix relay race condition in duckpond using a lock
Our duckpond suffered from a race condition: If multiple raw reaction
events were received in quick succession and a message had enough ducks
to take it over the duckpond threshold, the message would be relayed
multiple times.
The reason this happened is because the green checkmark emoji that stops
a message from being relayed multiple times is only added after the
message has been relayed. This means that multiple event triggers can
make it past the green checkmark check before any of them has a chance
to add a green checkmark.
The solution was to create a relay lock that needs to be acquired before
checking for the presence of a green checkmark and is only released
after adding a green checkmark. This prevents multiple events from
making it past the sentinel check.
As our Cogs are potentially initialized before the event loop is
created, the lock is load lazily when needed.
Signed-off-by: Sebastiaan Zeeff <[email protected]>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions