option to perform a full sync
This commit is contained in:
parent
83dc4405bf
commit
da34e00365
|
@ -43,8 +43,11 @@ def main(args):
|
||||||
num_folders_to_sync = len(mail.folder_structure)
|
num_folders_to_sync = len(mail.folder_structure)
|
||||||
logger.info(f'Syncing {num_folders_to_sync} folders...')
|
logger.info(f'Syncing {num_folders_to_sync} folders...')
|
||||||
|
|
||||||
last_refresh = database.have_we_done_a_full_sync_at_all()
|
if args.full:
|
||||||
last_refresh_imap_date = None
|
last_refresh = None
|
||||||
|
else:
|
||||||
|
last_refresh = database.have_we_done_a_full_sync_at_all()
|
||||||
|
last_refresh_imap_date = None
|
||||||
if last_refresh:
|
if last_refresh:
|
||||||
last_refresh_imap_date = unix_timestamp_since_to_imap_timestamp(last_refresh)
|
last_refresh_imap_date = unix_timestamp_since_to_imap_timestamp(last_refresh)
|
||||||
logger.info(f'Syncing emails received after {last_refresh_imap_date}')
|
logger.info(f'Syncing emails received after {last_refresh_imap_date}')
|
||||||
|
@ -81,5 +84,6 @@ def main(args):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description='Sync and archive your IMAP server.')
|
parser = argparse.ArgumentParser(description='Sync and archive your IMAP server.')
|
||||||
parser.add_argument('--config', default='config.yml', help='Path to config file.')
|
parser.add_argument('--config', default='config.yml', help='Path to config file.')
|
||||||
|
parser.add_argument('--full', action='store_true', help='Perform a full sync.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(args)
|
main(args)
|
||||||
|
|
Loading…
Reference in New Issue