예제 #1
0
파일: gmail.py 프로젝트: mdeng1024/inbox
 def download_and_commit_uids(self, crispin_client, folder_name, uids):
     raw_messages = safe_download(crispin_client, uids)
     with self.syncmanager_lock:
         # there is the possibility that another green thread has already
         # downloaded some message(s) from this batch... check within the
         # lock
         with mailsync_session_scope() as db_session:
             raw_messages = self.__deduplicate_message_object_creation(
                 db_session, raw_messages)
             if not raw_messages:
                 return 0
             new_imapuids = create_db_objects(
                 self.account_id, db_session, log, folder_name,
                 raw_messages, self.create_message)
             commit_uids(db_session, new_imapuids)
     return len(new_imapuids)
예제 #2
0
파일: gmail.py 프로젝트: olofster/inbox
 def download_and_commit_uids(self, crispin_client, folder_name, uids):
     raw_messages = safe_download(crispin_client, uids)
     with self.syncmanager_lock:
         # there is the possibility that another green thread has already
         # downloaded some message(s) from this batch... check within the
         # lock
         with mailsync_session_scope() as db_session:
             raw_messages = self.__deduplicate_message_object_creation(
                 db_session, raw_messages)
             if not raw_messages:
                 return 0
             new_imapuids = create_db_objects(
                 self.account_id, db_session, log, folder_name,
                 raw_messages, self.create_message)
             commit_uids(db_session, new_imapuids, self.provider_name)
     self.saved_uids.update(uids)
     return len(new_imapuids)