Skip to content
Snippets Groups Projects
Commit 7d00ecb0 authored by jkerdreu's avatar jkerdreu
Browse files

Slower refresh


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@3030 b32b6428-25c9-4566-ad07-03861ab6144f
parent 74de914c
Branches
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ import logging
logger = logging.getLogger(__name__)
# how often we force refresh the devices attributes/description/keyvalues
REFRESH_RATE = 300
REFRESH_RATE = 600
BOOT_TIMER = 1
REFRESH_TIMER = 7
AUTOWASH_TIMER = 10
......@@ -18,6 +18,7 @@ AUTOWASH_TIMER = 10
def now():
return int(time.time())
class TimedDict(dict):
def __init__(self,refresh_rate=REFRESH_RATE,data={}):
dict.__init__(self,data)
......@@ -26,7 +27,7 @@ class TimedDict(dict):
def updated(self):
self.last_update = now()
self.next_update = self.last_update + REFRESH_RATE + random.randint(-30,30)
self.next_update = self.last_update + REFRESH_RATE + random.randint(-30, 30)
def __setitem__(self, key, item):
super().__setitem__(key,item)
......@@ -206,7 +207,6 @@ class Devices:
print("%s %s" % (d.address,d.dev_type))
class Notification(Enum):
new_device = 0
drop_device = 1 # sending drop_device notif is not implemented yet,
......@@ -214,6 +214,7 @@ class Notification(Enum):
description_change = 3
metadata_change = 4
class Monitor:
"""
use this class to monitor a xAAL network
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment