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
Hi! Thank y'all for this project. I'm using the Subscribe() function and it seems like it occasionally misses deletion events. I set up this simple function to update a dictionary. Is this the proper way to interact with this? What might be a more thread-safe version of this assuming that it's a race condition?
.AsObservable<JToken>()
.Subscribe(d =>
{
if (d.EventType == Firebase.Database.Streaming.FirebaseEventType.InsertOrUpdate)
{
if (currentItems.ContainsKey(d.Key))
{
// Update item in dictionary
currentItems[d.Key] = d.Object;
}
else
{
// Add item to dictionary
currentItems.Add(d.Key, d.Object);
}
}
else if (d.EventType == Firebase.Database.Streaming.FirebaseEventType.Delete)
{
// Remove item from dictionary
currentItems.Remove(d.Key);
}
});
The text was updated successfully, but these errors were encountered:
Hi! Thank y'all for this project. I'm using the Subscribe() function and it seems like it occasionally misses deletion events. I set up this simple function to update a dictionary. Is this the proper way to interact with this? What might be a more thread-safe version of this assuming that it's a race condition?
The text was updated successfully, but these errors were encountered: