Skip to content

Commit

Permalink
chore: add unref call
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Mar 25, 2024
1 parent 246bb77 commit e416a64
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/conditional.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ export class ConditionalModule {
options?: { timeout: number },
) {
const { timeout = 5000 } = options ?? {};

const timer = setTimeout(() => {
throw new Error(
`Nest was not able to resolve the config variables within ${timeout} milliseconds. Bause of this, the ConditionalModule was not able to determine if ${module.toString()} should be registered or not`,
);
}, timeout);
timer.unref();

const returnModule: Required<
Pick<DynamicModule, 'module' | 'imports' | 'exports'>
> = { module: ConditionalModule, imports: [], exports: [] };
Expand Down

0 comments on commit e416a64

Please sign in to comment.