equeue: move takeover detection in thread lock.

parent 9199b64d
...@@ -115,10 +115,10 @@ class EqueueServer(SocketServer.ThreadingUnixStreamServer): ...@@ -115,10 +115,10 @@ class EqueueServer(SocketServer.ThreadingUnixStreamServer):
return False return False
def _runCommandIfNeeded(self, command, timestamp): def _runCommandIfNeeded(self, command, timestamp):
with self.thread_lock as thread_lock, self.lockfile as lockfile:
if self._hasTakeoverBeenTriggered(): if self._hasTakeoverBeenTriggered():
self.logger.info('Takeover has been triggered, preventing to run import script.') self.logger.info('Takeover has been triggered, preventing to run import script.')
return return
with self.thread_lock as thread_lock, self.lockfile as lockfile:
cmd_list = command.split('\0') cmd_list = command.split('\0')
cmd_readable = ' '.join(cmd_list) cmd_readable = ' '.join(cmd_list)
cmd_executable = cmd_list[0] cmd_executable = cmd_list[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment