mirror of
https://github.com/ppy/osu
synced 2024-12-25 08:12:41 +00: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.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Performance;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Scoring.Legacy;
|
||||
@ -51,6 +52,9 @@ namespace osu.Game.Database
|
||||
[Resolved]
|
||||
private ILocalUserPlayInfo? localUserPlayInfo { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IHighPerformanceSessionManager? highPerformanceSessionManager { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private INotificationOverlay? notificationOverlay { get; set; }
|
||||
|
||||
@ -493,7 +497,9 @@ namespace osu.Game.Database
|
||||
|
||||
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...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
|
Loading…
Reference in New Issue
Block a user