@@ -367,16 +367,23 @@ def _oneloop(self):
367367 return filecnt
368368
369369 try :
370+ # Check if the file exists before dequeuing
371+ pckfile = os .path .join (self .QDIR , filebase + '.pck' )
372+ if not os .path .exists (pckfile ):
373+ mailman_log ('error' , 'IncomingRunner._oneloop: File %s does not exist, skipping' , pckfile )
374+ continue
375+
376+ # Check if file is locked
377+ lockfile = os .path .join (self .QDIR , filebase + '.pck.lock' )
378+ if os .path .exists (lockfile ):
379+ mailman_log ('debug' , 'IncomingRunner._oneloop: File %s is locked by another process, skipping' , filebase )
380+ continue
381+
370382 # Dequeue the file
371383 msg , msgdata = self ._switchboard .dequeue (filebase )
372384
373385 # If dequeue failed due to file being locked, skip it
374386 if msg is None and msgdata is None :
375- # Check if the file is locked
376- lockfile = os .path .join (self .QDIR , filebase + '.pck.lock' )
377- if os .path .exists (lockfile ):
378- mailman_log ('debug' , 'IncomingRunner._oneloop: File %s is locked by another process, skipping' , filebase )
379- continue
380387 # For other None,None cases, shunt the message
381388 mailman_log ('error' , 'IncomingRunner._oneloop: Failed to dequeue file %s (got None values), shunting' , filebase )
382389 # Create a basic message and metadata if we don't have them
0 commit comments