From 1dd5e1ca89d78190cea96f56d0d05ee691ac7908 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 26 Nov 2021 14:43:35 +0900 Subject: [PATCH] Remove `RealmLive` context re-fetch optimisation for now --- osu.Game/Database/RealmLive.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/RealmLive.cs b/osu.Game/Database/RealmLive.cs index 5ee40f5b4d..45b598ed92 100644 --- a/osu.Game/Database/RealmLive.cs +++ b/osu.Game/Database/RealmLive.cs @@ -112,7 +112,10 @@ namespace osu.Game.Database } } - private bool originalDataValid => !IsManaged || (isCorrectThread && data.IsValid); + // TODO: Revisit adding these conditionals back as an optimisation: || (isCorrectThread && data.IsValid); + // They have temporarily been removed due to an oversight involving .AsQueryable, see https://github.com/realm/realm-dotnet/discussions/2734. + // This means we are fetching a new context every `PerformRead` or `PerformWrite`, even when on the correct thread. + private bool originalDataValid => !IsManaged; // this matches realm's internal thread validation (see https://github.com/realm/realm-dotnet/blob/903b4d0b304f887e37e2d905384fb572a6496e70/Realm/Realm/Native/SynchronizationContextScheduler.cs#L72) private bool isCorrectThread