@@ -96,31 +96,31 @@ def _set_queue_top(self, top):
9696 os .fsync (self ._file .fileno ())
9797
9898 self ._file .seek (current_pos , 0 )
99-
99+
100100 def _peek (self , block = False , timeout = None ):
101101 with self ._get_lock :
102102 _LOGGER .debug ("Peeking item" )
103-
103+
104104 if self ._length < 1 :
105105 if not block :
106106 raise queue .Empty
107-
107+
108108 # Wait for something to be added
109109 if self ._put_event .wait (timeout ) is False :
110110 # Nothing was added to the queue and timeout expired
111111 # This will never happen if timeout is None
112112 raise queue .Empty
113-
113+
114114 self ._put_event .clear ()
115-
115+
116116 with self ._file_lock :
117117 self ._file .seek (self ._get_queue_top (), 0 ) # Beginning of data
118118 length = struct .unpack (LENGTH_STRUCT , self ._file .read (4 ))[0 ]
119119 data = self ._file .read (length )
120120 item = self .loads (data )
121-
121+
122122 queue_top = self ._file .tell ()
123-
123+
124124 return item , queue_top
125125
126126 def qsize (self ):
@@ -176,12 +176,12 @@ def put(self, item, block=True, timeout=None):
176176 if self .maxsize > 0 and self ._length + 1 > self .maxsize :
177177 if not block :
178178 raise queue .Full
179-
179+
180180 if self ._get_event .wait (timeout ) is False :
181181 # Nothing was removed from the queue and timeout expired
182182 # This will never happen if timeout is None
183183 raise queue .Full
184-
184+
185185 self ._get_event .clear ()
186186
187187 # Convert the object outside of the file lock
@@ -282,7 +282,7 @@ def join(self):
282282 with self ._all_tasks_done :
283283 while self ._unfinished_tasks :
284284 self ._all_tasks_done .wait ()
285-
285+
286286 def peek (self , block = False , timeout = None ):
287287 """
288288 Peeks into the queue and returns an item without removing it.
@@ -379,7 +379,7 @@ def delete(self):
379379 Remove item from queue without reading object from file.
380380 """
381381 _LOGGER .debug ("Deleting item" )
382-
382+
383383 # If there is nothing in the queue, do nothing
384384 if self ._length < 1 :
385385 return
0 commit comments