mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 09:37:23 +08:00
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 System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage;
|
||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
@ -50,8 +51,6 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
this.connectionString = connectionString;
|
this.connectionString = connectionString;
|
||||||
|
|
||||||
Database.SetCommandTimeout(new TimeSpan(TimeSpan.TicksPerSecond * 10));
|
|
||||||
|
|
||||||
var connection = Database.GetDbConnection();
|
var connection = Database.GetDbConnection();
|
||||||
connection.Open();
|
connection.Open();
|
||||||
using (var cmd = connection.CreateCommand())
|
using (var cmd = connection.CreateCommand())
|
||||||
@ -68,7 +67,7 @@ namespace osu.Game.Database
|
|||||||
// this is required for the time being due to the way we are querying in places like BeatmapStore.
|
// 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.
|
// 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))
|
.ConfigureWarnings(warnings => warnings.Ignore(CoreEventId.IncludeIgnoredWarning))
|
||||||
.UseSqlite(connectionString)
|
.UseSqlite(connectionString, sqliteOptions => sqliteOptions.CommandTimeout(10))
|
||||||
.UseLoggerFactory(logger.Value);
|
.UseLoggerFactory(logger.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user