mirror of https://github.com/ppy/osu
Log backwards seeks to sentry
This commit is contained in:
parent
59b9d29a79
commit
19ed78eef5
|
@ -1190,6 +1190,9 @@ private void forwardGeneralLogsToNotifications()
|
|||
{
|
||||
if (entry.Level < LogLevel.Important || entry.Target > LoggingTarget.Database || entry.Target == null) return;
|
||||
|
||||
if (entry.Exception is SentryOnlyDiagnosticsException)
|
||||
return;
|
||||
|
||||
const int short_term_display_limit = 3;
|
||||
|
||||
if (recentLogCount < short_term_display_limit)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Input.Handlers;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
|
@ -29,6 +30,7 @@ public sealed partial class FrameStabilityContainer : Container, IHasReplayHandl
|
|||
public ReplayInputHandler? ReplayInputHandler { get; set; }
|
||||
|
||||
public bool AllowBackwardsSeeks { get; set; }
|
||||
private double? lastBackwardsSeekLogTime;
|
||||
|
||||
/// <summary>
|
||||
/// The number of CPU milliseconds to spend at most during seek catch-up.
|
||||
|
@ -163,10 +165,17 @@ private void updateClock()
|
|||
// time should never go backwards". If it does, we stop running gameplay until it returns to normal.
|
||||
if (!hasReplayAttached && FrameStablePlayback && proposedTime > referenceClock.CurrentTime && !AllowBackwardsSeeks)
|
||||
{
|
||||
Logger.Log($"Denying backwards seek during gameplay (reference: {referenceClock.CurrentTime:N2} stable: {proposedTime:N2})");
|
||||
if (lastBackwardsSeekLogTime == null || Math.Abs(Clock.CurrentTime - lastBackwardsSeekLogTime.Value) > 1000)
|
||||
{
|
||||
lastBackwardsSeekLogTime = Clock.CurrentTime;
|
||||
|
||||
if (parentGameplayClock is GameplayClockContainer gcc)
|
||||
Logger.Log($"{gcc.ChildrenOfType<FramedBeatmapClock>().Single().GetSnapshot()}");
|
||||
string loggableContent = $"Denying backwards seek during gameplay (reference: {referenceClock.CurrentTime:N2} stable: {proposedTime:N2})";
|
||||
|
||||
if (parentGameplayClock is GameplayClockContainer gcc)
|
||||
loggableContent += $"\n{gcc.ChildrenOfType<FramedBeatmapClock>().Single().GetSnapshot()}";
|
||||
|
||||
Logger.Error(new SentryOnlyDiagnosticsException("backwards seek"), loggableContent);
|
||||
}
|
||||
|
||||
state = PlaybackState.NotValid;
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Log to sentry without showing an error notification to the user.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This can be used to convey important diagnostics to us developers without
|
||||
/// getting in the user's way. Should be used sparingly.</remarks>
|
||||
internal class SentryOnlyDiagnosticsException : Exception
|
||||
{
|
||||
public SentryOnlyDiagnosticsException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue