option to perform a full sync

This commit is contained in:
Cyberes 2024-07-18 19:24:41 -06:00
parent 83dc4405bf
commit da34e00365
1 changed files with 6 additions and 2 deletions

View File

@ -43,8 +43,11 @@ def main(args):
num_folders_to_sync = len(mail.folder_structure)
logger.info(f'Syncing {num_folders_to_sync} folders...')
last_refresh = database.have_we_done_a_full_sync_at_all()
last_refresh_imap_date = None
if args.full:
last_refresh = None
else:
last_refresh = database.have_we_done_a_full_sync_at_all()
last_refresh_imap_date = None
if 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}')
@ -81,5 +84,6 @@ def main(args):
if __name__ == '__main__':
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('--full', action='store_true', help='Perform a full sync.')
args = parser.parse_args()
main(args)