mirror of https://github.com/ppy/osu
Use a more elegant method of setting the connection timeout
This commit is contained in:
parent
9aa46bfb0d
commit
1514d8451e
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using osu.Framework.Logging;
|
||||
|
@ -50,8 +51,6 @@ public OsuDbContext(string connectionString)
|
|||
{
|
||||
this.connectionString = connectionString;
|
||||
|
||||
Database.SetCommandTimeout(new TimeSpan(TimeSpan.TicksPerSecond * 10));
|
||||
|
||||
var connection = Database.GetDbConnection();
|
||||
connection.Open();
|
||||
using (var cmd = connection.CreateCommand())
|
||||
|
@ -68,7 +67,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|||
// this is required for the time being due to the way we are querying in places like BeatmapStore.
|
||||
// if we ever move to having consumers file their own .Includes, or get eager loading support, this could be re-enabled.
|
||||
.ConfigureWarnings(warnings => warnings.Ignore(CoreEventId.IncludeIgnoredWarning))
|
||||
.UseSqlite(connectionString)
|
||||
.UseSqlite(connectionString, sqliteOptions => sqliteOptions.CommandTimeout(10))
|
||||
.UseLoggerFactory(logger.Value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue