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

Implement proper DB recovery #11

Closed nisnevich closed 1 year ago

nisnevich commented 1 year ago

In case if a script terminates, there are a couple of problems while recovering from DB:

nisnevich commented 1 year ago

I see 2 recovery scenarios from the business perspective:

1) Fixed countdown that doesn't change during downtime. Once the bot is up again, it updates the timers in the voting channel, so all the timers are increased by the downtime interval.

2) Absolute timestamp. Once the bot is up again, it closes all proposals that should have been closed by that time. It will walk through the voters of each proposal on Discord, and apply decision according to the current state.

The 2 is simpler and more convenient from users perspective either, the only significant problem I see is this scenario:

1) Bot is down, and there's a proposal that should have been closed already. 2) The proposer is impatient and wants to apply the grant by himself, since the timer is over. So he does. 3) The bot is up again and applies the grant second time.

Solution is, if a downtime situation occurs, announce it ASAP with the time estimation of a fix, and ask everyone to wait until it's fixed, informing that the bot will apply all grants that should have been applied.

nisnevich commented 1 year ago

Fixed a while ago.