79415608

Date: 2025-02-05 17:23:41
Score: 1
Natty:
Report link

So, as mentioned by @mplungjan, it turns out that my problem was linked to an error in the code. Instead of using (() => this.downloadNextElement) or (() => this.downloadNextElement), I should have used () => setTimeout(() => this.downloadNextElement(), 250). I even reduced the delay between downloads, without any issue. So the code ends up being:

[...]
            FileUtility.downloadFile(this.application.remoteUrl + path, localPath, () => setTimeout(() => this.downloadNextElement(), 100), (downloadError) => {
                logError(`Error while downloading file ${this.application.remoteUrl + path} to local path ${localPath}: ${FileUtility.getErrorText(downloadError.code)}.`);
                setTimeout(() => this.downloadNextElement(), 100);
            });
[...]
    } else {
        FileUtility.deleteFile(localPath, () => setTimeout(() => this.downloadNextElement(), 100), (deleteError) => {
            logError(`Error while deleting ${localPath}: ${FileUtility.getErrorText(deleteError.code)}.`);
            setTimeout(() => this.downloadNextElement(), 100);
        });
    }
[...]
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @mplungjan
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: InLibrolivier