File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 44
55if sys .version_info [0 ] == 2 :
66 text_type = unicode
7- from Queue import Queue as Queue
7+ from Queue import Queue as Queue , Empty as QueueEmpty
88else :
99 text_type = str
10- from queue import Queue as Queue
10+ from queue import Queue as Queue , Empty as QueueEmpty
1111
1212try :
1313 import ujson as json # noqa: F401
Original file line number Diff line number Diff line change 77import pika
88from pika import credentials
99
10- from .compat import Queue
10+ from .compat import Queue , QueueEmpty
1111from .filters import FieldFilter
1212from .formatters import JSONFormatter
1313from .compat import ExceptionReporter
@@ -166,7 +166,7 @@ def message_worker(self):
166166 )
167167 )
168168
169- except Queue . Empty :
169+ except QueueEmpty :
170170 continue
171171 except Exception :
172172 self .channel , self .connection = None , None
@@ -175,9 +175,10 @@ def message_worker(self):
175175 if self .stopping .is_set ():
176176 self .stopped .set ()
177177 break
178- self .queue .task_done ()
179- if self .close_after_emit :
180- self .close_connection ()
178+ if not self .queue .empty ():
179+ self .queue .task_done ()
180+ if self .close_after_emit :
181+ self .close_connection ()
181182 self .stopped .set ()
182183
183184 def emit (self , record ):
You can’t perform that action at this time.
0 commit comments