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);
}
});
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?