Merge pull request #16529 from peppy/fix-realm-subscription-overhead

Remove all calls to `Realm.Refresh` to fix blocking overhead from subscriptions
This commit is contained in:
Dan Balasescu 2022-01-20 20:58:11 +09:00 committed by GitHub
commit 1a20725162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 23 deletions

View File

@ -46,9 +46,6 @@ public void Run()
migrateScores(ef);
}
Logger.Log("Refreshing realm...", LoggingTarget.Database);
realmContextFactory.Refresh();
// Delete the database permanently.
// Will cause future startups to not attempt migration.
Logger.Log("Migration successful, deleting EF database", LoggingTarget.Database);

View File

@ -61,10 +61,10 @@ public class RealmContextFactory : IDisposable, IRealmFactory
private readonly ThreadLocal<bool> currentThreadCanCreateContexts = new ThreadLocal<bool>();
private static readonly GlobalStatistic<int> refreshes = GlobalStatistics.Get<int>(@"Realm", @"Dirty Refreshes");
private static readonly GlobalStatistic<int> contexts_created = GlobalStatistics.Get<int>(@"Realm", @"Contexts (Created)");
private readonly object contextLock = new object();
private Realm? context;
public Realm Context
@ -169,18 +169,6 @@ private void cleanupPendingDeletions()
/// <returns></returns>
public bool Compact() => Realm.Compact(getConfiguration());
/// <summary>
/// Perform a blocking refresh on the main realm context.
/// </summary>
public void Refresh()
{
lock (contextLock)
{
if (context?.Refresh() == true)
refreshes.Value++;
}
}
public Realm CreateContext()
{
if (isDisposed)

View File

@ -351,13 +351,6 @@ protected override void LoadComplete()
FrameStatistics.ValueChanged += e => fpsDisplayVisible.Value = e.NewValue != FrameStatisticsMode.None;
}
protected override void Update()
{
base.Update();
realmFactory.Refresh();
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));