Skip to content

Commit

Permalink
fixup! perf: prefer use factory instead of use value when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
H4ad committed Nov 17, 2023
1 parent 8a2d19d commit 9a1ea46
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 10 deletions.
2 changes: 0 additions & 2 deletions packages/common/module-utils/configurable-module.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ export class ConfigurableModuleBuilder<
const providers: Array<Provider> = [
{
provide: self.options.optionsInjectionToken,
// useFactory is for performance reasons
// see more: https://github.com/nestjs/nest/issues/12738#issuecomment-1810987001
useFactory: () => this.omitExtras(options, self.extras),
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export class InternalCoreModuleFactory {
);
};

// useFactory is for performance reasons
// see more: https://github.com/nestjs/nest/issues/12738#issuecomment-1810987001
return InternalCoreModule.register([
{
provide: ExternalContextCreator,
Expand Down
2 changes: 0 additions & 2 deletions packages/core/router/router-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export class RouterModule {
providers: [
{
provide: ROUTES,
// useFactory is for performance reasons
// see more: https://github.com/nestjs/nest/issues/12738#issuecomment-1810987001
useFactory: () => routes,
},
],
Expand Down
2 changes: 0 additions & 2 deletions packages/microservices/module/clients.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export class ClientsModule {
const clientsOptions = !Array.isArray(options) ? options.clients : options;
const clients = (clientsOptions || []).map(item => ({
provide: item.name,
// useFactory is for performance reasons
// see more: https://github.com/nestjs/nest/issues/12738#issuecomment-1810987001
useFactory: () =>
this.assignOnAppShutdownHook(ClientProxyFactory.create(item)),
}));
Expand Down
2 changes: 0 additions & 2 deletions packages/platform-express/multer/multer.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export class MulterModule {
return {
module: MulterModule,
providers: [
// useFactory is for performance reasons
// see more: https://github.com/nestjs/nest/issues/12738#issuecomment-1810987001
{ provide: MULTER_MODULE_OPTIONS, useFactory: () => options },
{
provide: MULTER_MODULE_ID,
Expand Down

0 comments on commit 9a1ea46

Please sign in to comment.