elsirion / fedimint-observer

Fedimint Federation Explorer
https://observer.fedimint.org
10 stars 11 forks source link

If database is locked, syncing stops #11

Open justinmoon opened 5 months ago

justinmoon commented 5 months ago

If an error like this is encountered, it will stop syncing:

2024-04-18T19:42:18.641647Z ERROR task{name="Observer for <federation-id>"}: fedimint_observer::federation::observer: Observer errored: error returned from database: (code: 5) database is locked
douglaz commented 5 months ago

It was a long time since I've used sqlx with sqlite, but as far as I know if you have multiple writers to sqlite then it's highly likely that you'll get this error. See for instance: https://github.com/launchbadge/sqlx/issues/451

You can try to limit the pool connections to 1 or use a single connection inside a RwLock. Of course this only makes sense for sqlite because any other database will be able to have concurrent writers.