Easier refresh Folders

This commit is contained in:
djmaze 2021-03-18 13:52:56 +01:00
parent 11fd6736bb
commit 87bee226b4
4 changed files with 14 additions and 14 deletions

View file

@ -157,25 +157,23 @@ export const FolderUserStore = new class {
/**
* @returns {Array}
*/
getNextFolderNames() {
getNextFolderNames(ttl) {
const result = [],
limit = 10,
utc = Date.now(),
timeout = utc - 60000 * 5,
timeout = utc - ttl,
timeouts = [],
inboxFolderName = getFolderInboxName(),
bDisplaySpecSetting = this.displaySpecSetting(),
fSearchFunction = (list) => {
list.forEach(folder => {
if (
folder &&
inboxFolderName !== folder.fullNameRaw &&
folder.selectable &&
folder.exists &&
timeout > folder.interval &&
timeout > folder.expires &&
(folder.isSystemFolder() || (folder.subscribed() && (folder.checkable() || !bDisplaySpecSetting)))
) {
timeouts.push([folder.interval, folder.fullNameRaw]);
timeouts.push([folder.expires, folder.fullNameRaw]);
}
if (folder && folder.subFolders.length) {
@ -191,7 +189,7 @@ export const FolderUserStore = new class {
timeouts.find(aItem => {
const folder = getFolderFromCacheList(aItem[1]);
if (folder) {
folder.interval = utc;
folder.expires = utc;
result.push(aItem[1]);
}