LukeSmithxyz / mutt-wizard

A system for automatically configuring mutt and isync with a simple interface and safe passwords
GNU General Public License v3.0
2.39k stars 382 forks source link

Slow performance using `mailsync` shortcut [SOLVED] #957

Closed t-391 closed 1 month ago

t-391 commented 1 year ago

I've had an issue for a few months now, but only on one machine.

When launch neomutt and run the o shortcut to shell escape and run mailsync, the command will run to completion, but, for whatever reason, it hangs for 45 - 60s before it returns to my inbox.

It gets a little more strange. If I open a second terminal window and launch neomutt, my newly refreshed email will be there. I can read, reply, forward, etc. All while the first terminal window is just hanging. The amount of hang time is directly related to the number of new messages, ie, 20 new messages would take longer to 'return to inbox' than 2.

And further more, I've got two machines, a laptop(X-org, i3) and a desktop(Wayland, sway), both running arch, and both running mutt-wizard-git, but only the desktop has the issue. I can't really explain why this would happen, and I can't really tell if the issue is mutt-wizard or something else. In the laptop's case, even with 50 or more messages, the mailsync command is lightning fast.

Has anyone else experienced behavior like this before?

LukeSmithxyz commented 1 year ago

Mailsync also runs notmuch after mail is downloaded which indexes new mail to make it quickly searchable. That is probably what is lagging.

I'm going to guess that the difference in time between your two machines is probably that the one where it is instantaneous has a SSD and the one that takes a moment is a spinning disk hard drive (or perhaps a machine with less powerful memory or CPU).

t-391 commented 1 year ago

Hey Luke, regarding the hard disks, both machines are running NVME drives. But your tip about notmuch led me to a new discovery and a new question.

As a desktop test (the slow one) I ran the following commands separately on the terminal:

$mbsync -a
C: 1/1  B: 12/12  F: +0/0 *0/0 #0/0  N: +2/2 *0/0 #0/0
$notmuch new 
Processed 2 total files in almost no time.
Added 2 new messages to the database.

But compare this to the following:

$mw -Y
C: 1/1  B: 12/12  F: +0/0 *0/0 #0/0  N: +0/0 *0/0 #0/0

The expected output of notmuch doesn't echo its usual statement to the command line, and that's the exact point where it's hanging. I should also note running those commands separately here on the desktop executed and completed almost immediately.

Is there some reason why mw -Y wouldn't auto run notmuch new and echo it's output?

For comparison I ran o from neomutt on my laptop a few minutes ago, and it always echoes the notmuch report of "processed X files in X time".

t-391 commented 1 month ago

Well, it just turns out that I'm stupid. As @LukeSmithxyz accurately predicted, the slow performance was due to the use of spinning hard drive. While I had the mutt-wizard scripts installed onto NVME drives, the local mail storage ~/.local/share/mail/ was mounted to an old drive! I resolved the issue in a pretty straight forward manner:

mv -v ~/.local/share/mail/* /path/to/nvme/folder
cd ~/.local/share/
rmdir mail
ln -s /path/to/nvme/folder ./mail

Everything works fine now. I can't believe I battled this for a year... but, live and learn.