This commit is contained in:
Bevan Hunt 2020-02-06 14:38:03 -08:00
parent b2c691838e
commit 4437a2290b
1 changed files with 3 additions and 3 deletions

View File

@ -618,12 +618,12 @@ pub async fn broker() {
let newest_json = new_json.clone();
let tree_cloned = tree.clone();
let _ = tree_cloned.compare_and_swap(k, Some(serde_json::to_string(&old_json_clone).unwrap().as_bytes()), Some(serde_json::to_string(&newest_json).unwrap().as_bytes()));
let _ = tree_cloned.flush();
// only publish if events match - need to be published
for event in get_events() {
let key = k.clone();
if event.event == new_json.event {
let _ = tree_cloned.compare_and_swap(key, Some(serde_json::to_string(&old_json_clone).unwrap().as_bytes()), Some(serde_json::to_string(&newest_json).unwrap().as_bytes()));
let _ = tree_cloned.flush();
tx2.lock().unwrap().broadcast(event);
}
}