Skip to content

Instantly share code, notes, and snippets.

@smoogipoo
Last active March 8, 2022 16:25
Show Gist options
  • Save smoogipoo/56eda7ab56b9d1966556f2ca7a80a847 to your computer and use it in GitHub Desktop.
Save smoogipoo/56eda7ab56b9d1966556f2ca7a80a847 to your computer and use it in GitHub Desktop.
Realm-timing-related test failures
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestGameplayFlow
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestItemAddedAndDeletedByOtherUserDuringGameplay
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestItemAddedByOtherUserDuringGameplay
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestPlayStartsWithCorrectBeatmapWhileAtSongSelect
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestPlayStartsWithCorrectModsWhileAtSongSelect
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestPlayStartsWithCorrectRulesetWhileAtSongSelect
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestSpectatingStateNotResetOnBackButtonOutsideOfGameplay
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestSpectatingStateResetOnBackButtonDuringGameplay
osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayer.TestUserSetToIdleWhenBeatmapDeleted
osu.Game.Tests.Visual.Playlists.TestScenePlaylistsRoomCreation.TestLoadSimpleMatch
osu.Game.Tests.Visual.Playlists.TestScenePlaylistsRoomCreation.TestPlaylistItemSelectedOnCreate
osu.Game.Tests.Visual.SongSelect.TestSceneTopLocalRank.TestHigherScoreSet
diff --git a/osu.Game/Database/RealmObjectExtensions.cs b/osu.Game/Database/RealmObjectExtensions.cs
index 6dc18df9e0..a956e451d0 100644
--- a/osu.Game/Database/RealmObjectExtensions.cs
+++ b/osu.Game/Database/RealmObjectExtensions.cs
@@ -5,6 +5,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
+using System.Threading;
+using System.Threading.Tasks;
using AutoMapper;
using AutoMapper.Internal;
using osu.Game.Beatmaps;
@@ -279,7 +281,16 @@ public static Live<T> ToLive<T>(this T realmObject, RealmAccess realm)
if (!RealmAccess.CurrentThreadSubscriptionsAllowed)
throw new InvalidOperationException($"Make sure to call {nameof(RealmAccess)}.{nameof(RealmAccess.RegisterForNotifications)}");
- return collection.SubscribeForNotifications(callback);
+ return collection.SubscribeForNotifications((a, b, c) =>
+ {
+ SynchronizationContext ctx = SynchronizationContext.Current;
+
+ Task.Run(async () =>
+ {
+ await Task.Delay(2000).ConfigureAwait(false);
+ ctx.Post(_ => callback(a, b, c), null);
+ });
+ });
}
/// <summary>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment