sopel
sopel copied to clipboard
Handle DB failures better
Description
Sopel should be able to degrade to handle short database issues better
- don't throw exceptions when read only. Writes from things like seen could be thrown away or you could store in memory to run when back available
- Be able to use a replica if the DB is unavailable for some reason.
Reproduction steps
- Setup sopel with MariaDB
- Blow MariaDB up by putting in RO or shutting it down
- See exceptions and issues
Expected behavior
Sopel attempts to do as much as possible
Relevant logs
11:04:56 <MirahezeBotBeta> [2022-06-11 10:04:55,747] sopel.bot ERROR - Unexpected error ((MySQLdb._exceptions.OperationalError) (1290, 'The MariaDB server is running with the --read-only option so it cannot execute this statement') [SQL: UPDATE nick_values SET value=%s WHERE nick_values.nick_id = %s AND nick_values.`key` = %s] [parameters: ('1654941895.595715', 579, 'seen_timestamp')] (Background on this error at: https://sqlalche.me/e/14
Notes
No response
Sopel version
master
Installation method
./setup.py install
Python version
3.9.2
Operating system
Debian Bullseye
IRCd
Libera
Relevant plugins
seen
Same thing when the disk fills up and sqlite errors. It sends a huge error message after every single IRC message, spamming the hell out of its channels.
Sopel should degrade more gracefully with the changes in #2338, closing.
I was going to unassign Rusty at some point no matter what, since he's generally too busy to work on this stuff these days. But are you sure about closing this, @SnoopJ? The linked PR only addresses seen
, not the overall bot.db
object. 🤔
Hmm, that's a good point, it should stay open after all. Sorry for the noise :grimacing: