Skip to content

Commit

Permalink
fix: fileimport
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-KumarH committed Dec 11, 2024
1 parent d561979 commit 8f235ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,13 @@ export class Worker {
const fileImport = await import(require_dir + externalFile);
// check for double default
if (fileImport?.default?.default) {
await fileImport.default.default(cfg, logger, events, runWorker);
(async () => (await import(require_dir + externalFile)).default.default(cfg, logger, events, runWorker))().catch(err => {
this.logger.error(`Error scheduling external job ${externalFile}`, { err: err.message });
});
} else {
await fileImport.default(cfg, logger, events, runWorker);
(async () => (await import(require_dir + externalFile)).default(cfg, logger, events, runWorker))().catch(err => {
this.logger.error(`Error scheduling external job ${externalFile}`, { err: err.message });
});
}
}
catch (err: any) {
Expand Down

0 comments on commit 8f235ad

Please sign in to comment.