Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to limit the number of emails to pull #164

Closed
Lattitude75 opened this issue Jul 14, 2020 · 7 comments
Closed

Unable to limit the number of emails to pull #164

Lattitude75 opened this issue Jul 14, 2020 · 7 comments

Comments

@Lattitude75
Copy link

I have been unable to limit emails using the --limit option. Initially, I got the following error.

File "/usr/lib/python3.8/site-packages/lieer/gmailieer.py", line 608, in full_pull
    raise argparse.ArgumentError ('--limit with "remove_local_messages" will cause lots of messages to be deleted')
TypeError: __init__() missing 1 required positional argument: 'message'

After looking at the code, I found that a dry run might help, otherwise the update does not move forward and this time I repeatedly got keyError:xxxxxx like so

  File "/usr/lib/python3.8/site-packages/lieer/local.py", line 569, in update_tags
    fname = os.path.join (self.md, self.gids[gid])
KeyError: 'xxxxxxxxxxxxx'

The only way it could move ahead was by commenting out lines 607 and 608 in gmailieer.py:

      #if self.limit and not self.dry_run:
        #raise argparse.ArgumentError ('--limit with "remove_local_messages" will cause lots of messages to be deleted')

Now, I am able to limit the mails just by using:

gmi pull --limit 500

Is this a bug, or am I missing something?

@gauteh
Copy link
Owner

gauteh commented Jul 14, 2020 via email

@Lattitude75
Copy link
Author

Lattitude75 commented Jul 14, 2020

I think that feature should be added. It is very useful when you have an old email which has tens of thousands of emails, and you only want the recent ones. It was what cut my pull time from over 3 hours to about 5 minutes. Can this be added? I do not think it requires major changes too.

Edit: Also, I have been able to sync properly without any additional tags after the first full_pull.

@gauteh
Copy link
Owner

gauteh commented Jul 14, 2020 via email

@Lattitude75
Copy link
Author

Using age as a feature would be helpful. but I do understand that it has a fair bit of complexity. But, limiting by number of messages is a feature many mail sync commands including isync use. Since, it already seems to work fine, what can be done is to only let the pull with the --limit option if it is the very first run. Else, the option can be discarded with a warning. This way this feature can be added without the fear of data loss or inconsistencies. Because, it is only the very first time that this option is needed.

@Lattitude75
Copy link
Author

I created a pull request #165, to make the change. I do not think anything else is necessary.

@gauteh
Copy link
Owner

gauteh commented Jul 14, 2020 via email

@Lattitude75
Copy link
Author

Yes, that works too. You can leave it here, but please do not scrap off the option --limit. It is very useful.

I'll close the issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants