From ae1185e8e65fda3c81cdda2a1f7a683b9119331c Mon Sep 17 00:00:00 2001 From: Dmitry Astapov Date: Sun, 6 Sep 2015 22:02:47 +0100 Subject: [PATCH 1/2] When syncing chats, save last_id to the proper file "chat_last_id" instead of "email_last_id" (which breaks subsequent email and chat syncs) --- src/gmv/gmvault.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gmv/gmvault.py b/src/gmv/gmvault.py index a6e1bc1b..1abccf61 100755 --- a/src/gmv/gmvault.py +++ b/src/gmv/gmvault.py @@ -430,12 +430,12 @@ def _common_sync(self, a_timer, a_type, imap_req, compress, restart): """ # get all imap ids in All Mail imap_ids = self.src.search(imap_req) - + + last_id_file = self.OP_EMAIL_SYNC if a_type == "email" else self.OP_CHAT_SYNC # check if there is a restart if restart: LOG.critical("Restart mode activated for emails. Need to find information in Gmail, be patient ...") - imap_ids = self.get_gmails_ids_left_to_sync(self.OP_EMAIL_SYNC if a_type == "email" \ - else self.OP_CHAT_SYNC, imap_ids, imap_req) + imap_ids = self.get_gmails_ids_left_to_sync(last_id_file, imap_ids, imap_req) total_nb_msgs_to_process = len(imap_ids) # total number of emails to get @@ -542,7 +542,7 @@ def _common_sync(self, a_timer, a_type, imap_req, compress, restart): # save id every 10 restored emails if (nb_msgs_processed % 10) == 0: if gid: - self.save_lastid(self.OP_EMAIL_SYNC, gid, eml_date, imap_req) + self.save_lastid(last_id_file, gid, eml_date, imap_req) else: LOG.info("Could not process message with id %s. Ignore it\n" % (the_id)) self.error_report['empty'].append((the_id, gid if gid else None)) From 1ae16137245854b2ed04574384d7b8acccbd45b0 Mon Sep 17 00:00:00 2001 From: Dmitry Astapov Date: Sun, 6 Sep 2015 22:03:14 +0100 Subject: [PATCH 2/2] Record progress of chat restore in the proper file, without clobbering email restore file --- src/gmv/gmvault.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gmv/gmvault.py b/src/gmv/gmvault.py index 1abccf61..79f1dfb9 100755 --- a/src/gmv/gmvault.py +++ b/src/gmv/gmvault.py @@ -1023,7 +1023,7 @@ def restore_chats(self, extra_labels = [], restart = False): #pylint:disable=W01 # save id every nb_items restored emails # add the last treated gm_id - self.save_lastid(self.OP_EMAIL_RESTORE, last_id) + self.save_lastid(self.OP_CHAT_RESTORE, last_id) return self.error_report