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

afew is very slow #243

Open
greened opened this issue Aug 28, 2019 · 11 comments
Open

afew is very slow #243

greened opened this issue Aug 28, 2019 · 11 comments

Comments

@greened
Copy link

greened commented Aug 28, 2019

For some reason afew is taking a very long time (like a half hour or more) to process mail. Admittedly there are many mails (hundreds of thousands) but afew sits at the "Commit changes to N messages" for long periods.

Even when only processing new mail, afew takes much longer than I would expect.

@GuillaumeSeren
Copy link
Collaborator

Hello,
maybe you should check your backup before continue 🤣

Joke aside, to help you we need more informations,
find a command that produce the problem each time, some config param etc

I have a nearly 900k mail in my boxes and it works fine

@DearRude
Copy link

Even when only processing new mail, afew takes much longer than I would expect.

Same here. Even when there is no new mail, afew takes some seconds to process for me.

@GuillaumeSeren
Copy link
Collaborator

Hey @greened , @DearRude ,
can you get the duration of the request in notmuch vs afew (you can see those in verbose mode).

@DearRude
Copy link

dearrude@topol:~ » time notmuch new  
No new mail.
notmuch new  0.01s user 0.00s system 57% cpu 0.013 total
dearrude@topol:~ » time afew --new --tag -v
INFO:afew.filters.ListMailsFilter.ListMailsFilter:Tagging mailing list posts
INFO:afew.filters.ArchiveSentMailsFilter.ArchiveSentMailsFilter:Archiving all mails sent by myself to others
INFO:afew.filters.BaseFilter.Filter:Delete all spams
INFO:afew.filters.BaseFilter.Filter:Committing changes to 269 messages
INFO:afew.filters.BaseFilter.Filter:Filter from git
INFO:afew.filters.BaseFilter.Filter:Committing changes to 291 messages
INFO:afew.filters.BaseFilter.Filter:Filter all OSM related
INFO:afew.filters.BaseFilter.Filter:Committing changes to 2178 messages
INFO:afew.filters.BaseFilter.Filter:Sent from mail provider admin
INFO:afew.filters.BaseFilter.Filter:Committing changes to 6 messages
INFO:afew.filters.BaseFilter.Filter:All newsletters
INFO:afew.filters.BaseFilter.Filter:Committing changes to 114 messages
INFO:afew.filters.BaseFilter.Filter:No message specified for filter
INFO:afew.filters.BaseFilter.Filter:Committing changes to 596 messages
afew --new --tag -v  6.04s user 3.14s system 95% cpu 9.592 total

@GuillaumeSeren
Copy link
Collaborator

Hello @DearRude,
well nothing very strange to me here.

No new mail so nothing to do for notmuch 0.01s

Then each line in afew is doing a real query and adding some tag, and ~10s of afew run is not so slow if you consider how much stuff it does (it could be faster of course).

If you want to compare, you need to get a single process like:

INFO:afew.filters.BaseFilter.Filter:Filter from git
INFO:afew.filters.BaseFilter.Filter:Committing changes to 291 messages

Add a more verbose output to get the actual query, run each changes manually + time,
then compare it to a run of afew of this specific filter.

@DearRude
Copy link

Is it necessary for afew to query all mails even when there is no new mail? I don't want the existing mails to change at all.

@GuillaumeSeren
Copy link
Collaborator

Is it necessary for afew to query all mails even when there is no new mail? I don't want the existing mails to change at all.

Probably as afew is not the database itself, it has to rely on notmuch to return the list,
even if the list is empty, but maybe I missread you comment please explain.

@DearRude
Copy link

Committing changes to 269 messages

As listed in the verbose output, afew is committing changes to all mails. However, I'm running it with --new flag which only have to affect new mails. Does afew have to commit change to all mails even if --new flag is passed? Or simply afew can't tell the difference between new and old mails in my case?

@GuillaumeSeren
Copy link
Collaborator

Hey @DearRude ,
afew rely on notmuch for this, you need to configure notmuch to tag new mail, like:

[new]
tags=new
...

So if you use the --new option it will only target those new mail, if you increase the verbose level more,
you will see the query.

I was trying to say before, afew may be slow but you have to compare it to all the queries / changes it does.

@DearRude
Copy link

Ah got it. Thank you!

@DearRude
Copy link

Hey @GuillaumeSeren
Is there any chance you could add the feature of customizing the new tag from afew?

What I mean is that afew looks for other tags like unread instead of new?

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

3 participants