Make federation feed only report changes

This commit is contained in:
Sakuhl 2018-04-04 13:08:52 +02:00
parent efdc559fc0
commit 4655e43dba

View File

@ -97,6 +97,9 @@ pub fn federation_livefeed() {
let mut territories: Value = serde_json::from_reader(resp).unwrap();
let mut old_owned = vec![];
let mut old_owned_ffa = vec![];
let mut timestamp = territories.as_object().unwrap().get("request").unwrap().as_object().unwrap().get("timestamp").unwrap().as_u64().unwrap();
loop {
@ -126,6 +129,7 @@ pub fn federation_livefeed() {
}
}
if old_owned != assigned_owned_by_enemies || old_owned_ffa != ffa_owned_by_enemies {
for listener in federationfeed_listeners
.load::<FederationfeedListener>(&connection)
.expect("Error loading listeners") {
@ -135,6 +139,9 @@ FFA owned by others: {:?}",
ffa_owned_by_enemies
));
}
old_owned = assigned_owned_by_enemies;
old_owned_ffa = ffa_owned_by_enemies;
}
territories = new_territories;
}