Commit 6a563da4 authored by Joel Hockey's avatar Joel Hockey Committed by Chromium LUCI CQ

Run removeOldItems_() only once per session

I just discovered some flakiness locally doing --gtest_repeat on
Trash/FilesAppBrowserTest.Test/trashMoveToTrash.

this.trashDirs_ can be cleared by removeFileOrDirectory(), so we should
add an extra check and only run removeOldItems_() when the inProgress_
set exists.

Bug: 953310
Change-Id: Ie9db7ac577c473241c39cf9e8f03c75581e9d14d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567844Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832711}
parent 614ea7fe
......@@ -142,10 +142,12 @@ class Trash {
trashDirs = await TrashDirs.getTrashDirs(entry.filesystem, config);
// Check and remove old items max once per session.
this.removeOldItems_(trashDirs, config, Date.now()).then(() => {
// In-progress set is not required after removeOldItems_() runs.
this.inProgress_.delete(config.id);
});
if (this.inProgress_.has(config.id)) {
this.removeOldItems_(trashDirs, config, Date.now()).then(() => {
// In-progress set is not required after removeOldItems_() runs.
this.inProgress_.delete(config.id);
});
}
this.trashDirs_[config.id] = trashDirs;
return trashDirs;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment