refactor(core): Simplify createDeferredPromise, and add tests (no-changelog) (#10811)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-09-13 15:53:03 +02:00
committed by GitHub
parent d647ef41ac
commit cef64329a9
14 changed files with 66 additions and 43 deletions

View File

@@ -507,7 +507,7 @@ export class EmailReadImapV1 implements INodeType {
return newEmails;
};
const returnedPromise = await this.helpers.createDeferredPromise();
const returnedPromise = this.helpers.createDeferredPromise();
const establishConnection = async (): Promise<ImapSimple> => {
let searchCriteria = ['UNSEEN'] as Array<string | string[]>;
@@ -560,7 +560,7 @@ export class EmailReadImapV1 implements INodeType {
});
// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy
// if it receives an error before the workflow got activated
await returnedPromise.promise().then(() => {
await returnedPromise.promise.then(() => {
this.emitError(error as Error);
});
}