Closed Bug 1554424 Opened 1 year ago Closed 1 year ago

Do not load target folder if no periodic filters exist

Categories

(MailNews Core :: Filters, defect)

defect
Not set
normal

Tracking

(thunderbird68 fixed, thunderbird69 fixed)

RESOLVED FIXED
Thunderbird 69.0
Tracking Status
thunderbird68 --- fixed
thunderbird69 --- fixed

People

(Reporter: aceman, Assigned: aceman)

References

(Depends on 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file)

At https://searchfox.org/comm-central/rev/9fa0de5c8d0841f5aa26e91d941264f42ad1c81c/mailnews/base/search/src/PeriodicFilterManager.jsm#78 we have code like this:

let foldersToFilter = server.rootFolder.getFoldersWithFlags(Ci.nsMsgFolderFlags.Inbox);
if (!foldersToFilter.length)
continue;
....
for (let i = 0; i < numFilters; i++) {
let curFilter = curFilterList.getFilterAt(i);
// Only add enabled, UI visible filters that are of the Periodic type.
if (curFilter.enabled && !curFilter.temporary &&
(curFilter.filterType & Ci.nsMsgFilterType.Periodic)) {
tempFilterList.insertFilterAt(newFilterIndex, curFilter);
}
}
MailServices.filters.applyFiltersToFolders(tempFilterList, foldersToFilter, null);

Before we enumerate the periodic filters to run (if any) we first lookup the Inbox folder of the server. This basically adds the Inbox folders of ALL accounts to the folder cache. The cache is quite small (30 folders by default). If you have many accounts , even some "dead" ones, for which no mail is fetched or no filters defined, this may push out useful folders out of the cache. It may be expensive to reload those other folders again.

We could try to avoid loading the Inbox folders for accounts that have no periodic filters to run.

nit - If this is a performance issue to bug 864187 then I'd call this a defect and not an enhancement.

Depends on: 1554387
Assignee: nobody → acelists
Status: NEW → ASSIGNED
Type: enhancement → defect
Attached patch 1554424.patchSplinter Review

First check if there are any periodic filters, then get folders.

Attachment #9067646 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9067646 [details] [diff] [review]
1554424.patch

Review of attachment 9067646 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, r=mkmelin
Attachment #9067646 - Flags: review?(mkmelin+mozilla) → review+

Thanks

Depends on: 1551043
Keywords: checkin-needed
Attachment #9067646 - Flags: approval-comm-beta+

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/19ec36793dc9
do not periodically load Inbox folder for account that has no periodic filters defined. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 69.0
You need to log in before you can comment on or make changes to this bug.