Skip to content

Instantly share code, notes, and snippets.

@mart-e
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mart-e/82132b01c91f3238052c to your computer and use it in GitHub Desktop.
Save mart-e/82132b01c91f3238052c to your computer and use it in GitHub Desktop.
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py
index 515881e..ec047fb 100644
--- a/addons/fetchmail/fetchmail.py
+++ b/addons/fetchmail/fetchmail.py
@@ -180,6 +180,7 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
def fetch_mail(self, cr, uid, ids, context=None):
"""WARNING: meant for cron usage only - will commit() after each email!"""
+ _logger.warning("FETCHMAIL %s" % id(cr))
if context is None:
context = {}
context['fetchmail_cron_running'] = True
@@ -197,6 +198,11 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
imap_server.select()
result, data = imap_server.search(None, '(UNSEEN)')
for num in data[0].split():
+ _logger.warning("COMMIT %s" % num)
+ cr.commit()
+ time.sleep(100)
+ _logger.warning("END SLEEP %s" % num)
+
res_id = None
result, data = imap_server.fetch(num, '(RFC822)')
imap_server.store(num, '-FLAGS', '\\Seen')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment