proc_stats: check for network updates every 10 seconds

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-11-25 07:59:55 -05:00
parent b33183f60f
commit ccb86ea039
2 changed files with 4 additions and 1 deletions

View File

@ -430,7 +430,8 @@ class Machine:
addresses: List[Dict[str, Any]] = [
{
'family': IP_FAMILIES[addr['family']],
'address': addr['local']
'address': addr['local'],
'is_link_local': addr.get('scope', "") == "link"
}
for addr in interface.get('addr_info', [])
if 'family' in addr and 'local' in addr
@ -441,6 +442,7 @@ class Machine:
}
except Exception:
logging.exception("Error processing network update")
return
prev_network = self.system_info.get('network', {})
if notify and network != prev_network:
self.server.send_event("machine:net_state_changed", network)

View File

@ -163,6 +163,7 @@ class ProcStats:
self.server.send_event("proc_stats:cpu_throttled", ts)
self.last_throttled = cur_throttled
self.total_throttled |= cur_throttled
await self.machine.parse_network_interfaces()
await self.machine.update_service_status()
async def _check_throttled_state(self) -> Dict[str, Any]: