Commit 72f2b424 authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Add retries/fail to label count mismatch logic

parent c26620e2
......@@ -20,6 +20,7 @@ class Mover:
self.__dict__.update(args)
self.config = config
self.logger = logging.getLogger(__name__)
self.retries = 0
try:
cmd([
......@@ -133,7 +134,16 @@ class Mover:
'Message count mismatch. Retrying transfer.',
extra={'entity': self.current_owner}
)
self.process_label(label)
self.retries += 1
if self.retries <= 3:
self.process_label(label)
else:
self.logger.warning(
'Unable to transfer \'{}\''.format(label['original']),
extra={'entity': self.current_owner}
)
self.retries = 0
return False
else:
self.logger.info(
'Message counts match between mailboxes',
......
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