Closed jobisoft closed 3 months ago
The compact is happening asynchronously on purpose. It becomes a user-visible delay if it's done synchronously, and now that I've had to increase it from 1 second to 2 seconds because 1 second apparently isn't enough, that would make it even worse for it to happen synchronously.
Commit https://github.com/Extended-Thunder/send-later/commit/fd3d19bab2f0bb945747b4d211f6e6356e5fa7bb introduced a delay to mitigate Bug 1909111.
The change adds a delay before compacting, which resolves the error reported to this project, which is primarily caused by the mentioned underlying Thunderbird bug.
That commit changed the execution flow: The used
setTimeout()
causes the Promise returned bycompactDrafts()
to resolve before the compacting has started. This is a change in behaviour which could have unwanted side effects. There are multiple calls toawait compactDrafts()
which assume that any code executed after callingawait compactDrafts()
is executed after compacting has finished.This PR suggests keeping the 1s delay to mitigate Bug 1909111, but make the Promise returned by
compactDrafts()
resolve after the additional delay and after compacting the folder has finished, restoring the original execution flow and keeping the 1s delay to mitigate Thunderbird Bug 1909111.