nisnevich / discord-consensus-bot

A Discord bot for a consensus in decentralised organisations (e.g. DAO). Implements a lazy consensus and full consensus models.
MIT License
5 stars 4 forks source link

Errors when cancelling proposal at the very last moment #10

Closed nisnevich closed 1 year ago

nisnevich commented 1 year ago

When the proposal is cancelled at the very last seconds (when grant approval coroutine has already started), various errors occur. This should be fixed by checking a lock.

nisnevich commented 1 year ago

Another case:

  1. Last voter is clicking to cancel
  2. Coroutine starts but doesn't update the message immediately
  3. The voter clicks a couple more times

Result: the proposal is cancelled, however exceptions are thrown

Solution: a lock should be associated with proposal id, and checked in on_raw_reaction_add one of the first things

nisnevich commented 1 year ago

Another case:

  1. DB recovery in progress
  2. User removes his vote from a message

Adding vote is handled correctly (the added reaction is just removed, the user is DMed).

Solution could be: prevent removing the reaction (if it's possible).

nisnevich commented 1 year ago

Fixed.