From 65f85ee76dd7212318761514197c6fdc19bcf8e4 Mon Sep 17 00:00:00 2001 From: Swann Martinez Date: Thu, 11 Apr 2019 16:27:01 +0200 Subject: [PATCH] feat(rcf): fix violation error by disabling timer --- client.py | 23 ++++++++++++++--------- operators.py | 3 +-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/client.py b/client.py index 56bcbfb..7d04e7c 100644 --- a/client.py +++ b/client.py @@ -140,6 +140,8 @@ class RCFClientAgent(object): id = None state = State.INITIAL server = None + serial = None + serialisation_agent = None def __init__(self, ctx, pipe): self.ctx = ctx @@ -152,6 +154,11 @@ class RCFClientAgent(object): self.publisher.setsockopt(zmq.IDENTITY, self.id) self.publisher.setsockopt(zmq.SNDHWM, 60) self.publisher.linger = 0 + self.serial, peer = zpipe(self.ctx) + self.serial_agent = threading.Thread( + target=serialization_agent, args=(self.ctx, peer)) + self.serial_agent.daemon = True + self.serial_agent.start() def control_message(self): msg = self.pipe.recv_multipart() @@ -261,28 +268,26 @@ class SerializationAgent(object): ctx = None pipe = None - def __init__(self, ctx, pipe_in, pipe_out): + def __init__(self, ctx, pipe): self.ctx = ctx - self.pipe_in = pipe_in - self.pipe_out = pipe_out + self.pipe = pipe + logger.info("serialisation service launched") def control_message(self): - msg = self.pipe_in.recv_multipart() + msg = self.pipe.recv_multipart() command = msg.pop(0) if command == b"DUMP": key = umsgpack.unpackb(msg[0]) - logger.log("Dumping....") elif command == b"LOAD": key, value = msg - logger.log("Loading....") -def serialization_agent(ctx, pipe_in, pipe_out): - agent = SerializationAgent(ctx, pipe_in, pipe_out) - server = None +def serialization_agent(ctx, pipe): + agent = SerializationAgent(ctx, pipe) + global stop while True: diff --git a/operators.py b/operators.py index 602726b..c44de54 100644 --- a/operators.py +++ b/operators.py @@ -304,7 +304,7 @@ def default_tick(): # except Exception as e: # print("pull error: {}".format(e)) - bpy.ops.session.refresh() + # bpy.ops.session.refresh() return 0.5 @@ -620,7 +620,6 @@ def depsgraph_update(scene): updates = bpy.context.depsgraph.updates # update_selected_object(bpy.context) push = False - # Update selected object # for update in updates.items():