Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zqfan committed Jul 21, 2023
1 parent 1f2b55a commit 1597a83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion kazoo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ def __init__(
self.logger = logger or log

# Record the handler strategy used
self.handler = handler or SequentialThreadingHandler(logger=self.logger)
self.handler = handler
if not handler:
self.handler = SequentialThreadingHandler(logger=self.logger)
if inspect.isclass(self.handler):
raise ConfigurationError(
"Handler must be an instance of a class, "
Expand Down
3 changes: 2 additions & 1 deletion kazoo/handlers/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def running(self):
return self._running

def _create_thread_worker(self, work_queue):
log = self.logger
def _thread_worker(): # pragma: nocover
while True:
try:
Expand All @@ -119,7 +120,7 @@ def _thread_worker(): # pragma: nocover
break
func()
except Exception:
self.logger.exception("Exception in worker queue thread")
log.exception("Exception in worker queue thread")
finally:
work_queue.task_done()
del func # release before possible idle
Expand Down

0 comments on commit 1597a83

Please sign in to comment.