Skip to content

Commit

Permalink
fix(): filter out request scoped classes
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Mar 11, 2021
1 parent b34628d commit 4879ff8
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/schedule.explorer.ts
Expand Up @@ -26,17 +26,19 @@ export class ScheduleExplorer implements OnModuleInit {
...this.discoveryService.getControllers(),
...this.discoveryService.getProviders(),
];
instanceWrappers.forEach((wrapper: InstanceWrapper) => {
const { instance } = wrapper;
if (!instance || !Object.getPrototypeOf(instance)) {
return;
}
this.metadataScanner.scanFromPrototype(
instance,
Object.getPrototypeOf(instance),
(key: string) => this.lookupSchedulers(instance, key),
);
});
instanceWrappers
.filter((wrapper) => wrapper.isDependencyTreeStatic())
.forEach((wrapper: InstanceWrapper) => {
const { instance } = wrapper;
if (!instance || !Object.getPrototypeOf(instance)) {
return;
}
this.metadataScanner.scanFromPrototype(
instance,
Object.getPrototypeOf(instance),
(key: string) => this.lookupSchedulers(instance, key),
);
});
}

lookupSchedulers(instance: Record<string, Function>, key: string) {
Expand Down

0 comments on commit 4879ff8

Please sign in to comment.