diff --git a/src/event_handlers/event_handler_main.py b/src/event_handlers/event_handler_main.py index 3875054..52f5130 100644 --- a/src/event_handlers/event_handler_main.py +++ b/src/event_handlers/event_handler_main.py @@ -71,7 +71,6 @@ def login_handler(data, component): def source_code_handler(data, event_handler): - event_handler.unsubscribe(data['anchor']) yield (data['anchor'], source_code.get_source_code(authorize_login, strip_comments=True)) diff --git a/src/event_handlers/stateful_event_handler.py b/src/event_handlers/stateful_event_handler.py index 5ba3bfe..f03e105 100644 --- a/src/event_handlers/stateful_event_handler.py +++ b/src/event_handlers/stateful_event_handler.py @@ -21,7 +21,11 @@ class StatefulEventHandler(EventHandlerBase): data_json = json.loads(message) if self.generator is None: self.generator = self.event_handler_function(data_json, self) - response_anchor, response_data = next(self.generator) + try: + response_anchor, response_data = next(self.generator) + except StopIteration: + self.reset() + return if response_anchor not in self.subscriptions: self.subscriptions.add(response_anchor) self.zmq_sub_socket.setsockopt_string(zmq.SUBSCRIBE, response_anchor)