From ee72962ee5da3e4c01f404a712e5a3fa894f149f Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Thu, 22 Jun 2017 00:12:29 +0200 Subject: [PATCH] Possible database lock fix --- src/NadekoBot/Modules/Utility/Utility.cs | 5 +++-- src/NadekoBot/Services/Database/NadekoContext.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index c26e584e..51f24efc 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -285,9 +285,10 @@ namespace NadekoBot.Modules.Utility { if (--page < 0) return; - var statuses = _bot.ShardCoord.Statuses.ToArray(); + var statuses = _bot.ShardCoord.Statuses.ToArray() + .Where(x => x != null); + var status = string.Join(", ", statuses - .Where(x => x != null) .GroupBy(x => x.ConnectionState) .Select(x => $"{x.Count()} {x.Key}") .ToArray()); diff --git a/src/NadekoBot/Services/Database/NadekoContext.cs b/src/NadekoBot/Services/Database/NadekoContext.cs index 9c084867..b61c9aa9 100644 --- a/src/NadekoBot/Services/Database/NadekoContext.cs +++ b/src/NadekoBot/Services/Database/NadekoContext.cs @@ -18,8 +18,9 @@ namespace NadekoBot.Services.Database public NadekoContext Create(DbContextFactoryOptions options) { var optionsBuilder = new DbContextOptionsBuilder(); - optionsBuilder.UseSqlite("Filename=./data/NadekoBot.db"); - return new NadekoContext(optionsBuilder.Options); + optionsBuilder.UseSqlite("Filename=./data/NadekoBot.db;Default Command Timeout=60000;Busy Timeout=60000"); + var ctx = new NadekoContext(optionsBuilder.Options); + return ctx; } }