mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-07-19 13:54:44 -04:00
[PR #986] [MERGED] Try to fix sporadic exceptions from SQLite (Error 5: 'database is locked') #994
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/RPCS3/discord-bot/pull/986
Author: @13xforever
Created: 3/27/2025
Status: ✅ Merged
Merged: 3/27/2025
Merged by: @13xforever
Base:
master← Head:vnext📝 Commits (6)
55f4545use read/write locking for sqlite to fix Error 5: 'database is locked'5ef4301more ValueTask updates4cc1bbdtry to reduce write lock situations87ce974try to return game updates from cache when possible1a9359dswitch to AsyncReadWriteLock to support async/await756c4f6fix deadlock on botdb📊 Changes
64 files changed (+546 additions, -335 deletions)
View changed files
📝
CompatBot/Commands/Audit.cs(+3 -2)📝
CompatBot/Commands/AutoCompleteProviders/BotConfigurationAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/AutoCompleteProviders/ContentFilterAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/AutoCompleteProviders/EventIdAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/AutoCompleteProviders/EventNameAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/AutoCompleteProviders/ExplainAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/AutoCompleteProviders/InviteAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/AutoCompleteProviders/ProductCodeAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/AutoCompleteProviders/WarningAutoCompleteProvider.cs(+1 -1)📝
CompatBot/Commands/Bot.Configuration.cs(+3 -3)📝
CompatBot/Commands/Bot.Import.cs(+1 -1)📝
CompatBot/Commands/Bot.cs(+5 -5)📝
CompatBot/Commands/BotStatus.cs(+25 -20)📝
CompatBot/Commands/CommandsManagement.cs(+12 -12)📝
CompatBot/Commands/CompatList.Latest.cs(+1 -1)📝
CompatBot/Commands/CompatList.Top.cs(+1 -1)📝
CompatBot/Commands/CompatList.cs(+9 -8)📝
CompatBot/Commands/ContentFilters.cs(+6 -6)📝
CompatBot/Commands/Events.cs(+8 -8)📝
CompatBot/Commands/Explain.cs(+6 -6)...and 44 more files
📄 Description
Apparently this happens when read transaction got started as read-only, but then failed to be promoted to write because there was another write in the meantime.
Tracking issue on dotnet/efcore#29514.
So, try to separate reads/writes with a read/write lock per database.
As part of this effort there's been a lot of async code clean up, with some logic and resource management fixes, as well as further switch to
ValueTaskwherever possible.Also, game updates are now returned from bot's cache when possible (refreshed once a day if needed).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.