mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Stop background processing from running when inside a high performance session
This commit is contained in:
parent
d89edd2b4f
commit
a651cb8d50
@ -16,6 +16,7 @@ using osu.Game.Extensions;
|
|||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using osu.Game.Performance;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Scoring.Legacy;
|
using osu.Game.Scoring.Legacy;
|
||||||
@ -51,6 +52,9 @@ namespace osu.Game.Database
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private ILocalUserPlayInfo? localUserPlayInfo { get; set; }
|
private ILocalUserPlayInfo? localUserPlayInfo { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IHighPerformanceSessionManager? highPerformanceSessionManager { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private INotificationOverlay? notificationOverlay { get; set; }
|
private INotificationOverlay? notificationOverlay { get; set; }
|
||||||
|
|
||||||
@ -493,7 +497,9 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
private void sleepIfRequired()
|
private void sleepIfRequired()
|
||||||
{
|
{
|
||||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
// Importantly, also sleep if high performance session is active.
|
||||||
|
// If we don't do this, memory usage can become runaway due to GC running in a more lenient mode.
|
||||||
|
while (localUserPlayInfo?.IsPlaying.Value == true || highPerformanceSessionManager?.IsSessionActive == true)
|
||||||
{
|
{
|
||||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||||
|
Loading…
Reference in New Issue
Block a user