Add tracking of total subscriptions

This commit is contained in:
Dean Herbert
2022-01-24 20:23:10 +09:00
parent 05a2d7fbfe
commit 5fb9b58c9b

View File

@ -83,6 +83,8 @@ namespace osu.Game.Database
private static readonly GlobalStatistic<int> realm_instances_created = GlobalStatistics.Get<int>(@"Realm", @"Instances (Created)"); private static readonly GlobalStatistic<int> realm_instances_created = GlobalStatistics.Get<int>(@"Realm", @"Instances (Created)");
private static readonly GlobalStatistic<int> total_subscriptions = GlobalStatistics.Get<int>(@"Realm", @"Subscriptions");
private readonly object realmLock = new object(); private readonly object realmLock = new object();
private Realm? updateRealm; private Realm? updateRealm;
@ -289,6 +291,8 @@ namespace osu.Game.Database
var syncContext = SynchronizationContext.Current; var syncContext = SynchronizationContext.Current;
total_subscriptions.Value++;
registerSubscription(action); registerSubscription(action);
// This token is returned to the consumer. // This token is returned to the consumer.
@ -309,6 +313,7 @@ namespace osu.Game.Database
unsubscriptionAction?.Dispose(); unsubscriptionAction?.Dispose();
customSubscriptionsResetMap.Remove(action); customSubscriptionsResetMap.Remove(action);
notificationsResetMap.Remove(action); notificationsResetMap.Remove(action);
total_subscriptions.Value--;
} }
} }
} }