Optimization in KDE-PIM
Defer UID map saving when there's heavy incoming traffic
Previously, the seq->UID map would get rebuilt and saved into the DB
upon every EXPUNGE. That was quite expensive, as the test which deletes
15k out of 30k messages quite clearly indicates. This code makes sure
that the rate in which the data are saved is limited.
Originally, this was implemented by maintaining a pretty short time
window. The goal was to prevent excessive actions while the responses
still continue to flow, but at the same time to avoid excessive delays
in case the burst stops. I wanted the time window to be reasonable small
so as not to require adding multiple qWait()s into other tests. A single
EXPUNGE is typically less than 18 bytes ("* 1234567 EXPUNGE\r\n"), so in
order to send 100+ of them in a 10ms, it could require a 180 kBps, i.e.
about 1.44 Mbps bandwidth (at least as a burst). That might indeed be a
bit too high for a cell phone connection :(, as Thomas pointed out.
That's why the time window is a bit longer now.
Also make sure that no events get lost when the KeepMailboxOpenTask dies
prior to a timer firing, such as when switching mailboxes.