You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we call CurrentClientLifetime N times and then terminate lifetime of LocalCodeWithMeClientManager which removes a client we get a N^2 calls of ValueLifetime.ClearValueIfNotAlive
publicstatic Lifetime CurrentClientLifetime(thisICodeWithMeClientManagermanager){varclientId= ClientId.Current;varlifetimeDefinition= Lifetime.Define(Lifetime.Eternal,$"Lifetime of {clientId}");
Log.Assert(manager.Clients.Contains(clientId),$"Client manager doesn't know about {clientId}");varlifetime= lifetimeDefinition.Lifetime;
manager.Clients.Advise(lifetime,(addRemove,triggeredId)=>{if(addRemove== AddRemove.Remove &&triggeredId==clientId){ lifetimeDefinition.Terminate();}});returnlifetime;}
....
public class LocalCodeWithMeClientManager : ICodeWithMeClientManager
{
public LocalCodeWithMeClientManager(Lifetimelifetime){
Clients.Add(ClientId.LocalId);
lifetime.OnTermination(()=> Clients.Remove(ClientId.LocalId));}publicIViewableSet<ClientId>Clients{ get;}=newViewableSet<ClientId>();}
The text was updated successfully, but these errors were encountered:
If we call
CurrentClientLifetime
N times and then terminate lifetime ofLocalCodeWithMeClientManager
which removes a client we get a N^2 calls ofValueLifetime.ClearValueIfNotAlive
The text was updated successfully, but these errors were encountered: