Fix last_reachable timestamp bug
Change-Id: I0d479c9aef59866db164790247eca2c3c6e1f0bf
diff --git a/app.py b/app.py
index 44c91ec..e7ede6a 100644
--- a/app.py
+++ b/app.py
@@ -78,9 +78,10 @@
default="3333")
return parser
-def update(roc, prom, devices):
- roc.update_devices(devices)
- prom.update_devices(devices)
+def update(roc, prom, old):
+ new = roc.update_devices(old)
+ prom.update_devices(new)
+ return new
def probe(devices):
for imsi_id, device in devices.items():
@@ -97,11 +98,11 @@
def work_thread(roc, prom):
global devices, lock
while True:
- temp_devices = {}
- update(roc, prom, temp_devices)
- probe(temp_devices)
+ new = update(roc, prom, devices)
+ probe(new)
with lock:
- devices = temp_devices
+ devices = new
+
time.sleep(5)
if __name__ == '__main__':