feat(client): naive watchdog update

This commit is contained in:
Swann Martinez 2019-05-02 18:40:42 +02:00
parent 5fd13eb5ba
commit fc284cee57
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1

View File

@ -85,7 +85,7 @@ class RCFClient(object):
# Database and connexion agent # Database and connexion agent
self.watchdog_agent = threading.Thread( self.watchdog_agent = threading.Thread(
target=watchdog_worker, args=(self.serial_feed, .5, self.stop_event), name="watchdog-agent") target=watchdog_worker, args=(self.serial_feed, 2, self.stop_event), name="watchdog-agent")
self.watchdog_agent.daemon = True self.watchdog_agent.daemon = True
self.watchdog_agent.start() self.watchdog_agent.start()
@ -502,12 +502,15 @@ def watchdog_worker(feed,interval, stop_event):
for datatype in helpers.SUPPORTED_TYPES: for datatype in helpers.SUPPORTED_TYPES:
for item in getattr(bpy.data, helpers.CORRESPONDANCE[datatype]): for item in getattr(bpy.data, helpers.CORRESPONDANCE[datatype]):
key = "{}/{}".format(datatype, item.name)
if item.id == 'None': if item.id == 'None':
item.id = bpy.context.scene.session_settings.username item.id = bpy.context.scene.session_settings.username
key = "{}/{}".format(datatype, item.name)
feed.put(('DUMP',key,None)) feed.put(('DUMP',key,None))
elif item.is_dirty: elif item.is_dirty:
logger.info("{} needs update".format(item.name)) logger.info("{} needs update".format(item.name))
feed.put(('DUMP',key,None))
item.is_dirty = False
time.sleep(interval) time.sleep(interval)
logger.info("watchdog thread stopped") logger.info("watchdog thread stopped")