NestJs启动延迟

som*_*ser 6 typescript nestjs prisma

我有一个不错的 NestJs 项目。我使用 Graphql CLI 插件和 Prisma 作为 ORM。

无论我如何启动项目(start:dev、、),在加载所有模块并注册所有路由后都会出现延迟startstart:prod

[Nest] 29996   - 20.02.2021, 13:41:03   [NestFactory] Starting Nest application...
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] DiscoveryModule dependencies initialized +331ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] AppModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ServeStaticModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ConfigModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ScheduleModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ConfigModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +3ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] GraphQLModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RoutesResolver] AppController {}: +584ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RouterExplorer] Mapped {, GET} route +5ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RoutesResolver] xxxController {/xxx}: +1ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RouterExplorer] Mapped {/xxx, POST} route +2ms
...
[Nest] 29996   - 20.02.2021, 13:41:04   [RouterExplorer] Mapped {/xxx/:id, DELETE} route +1ms
[Nest] 29996   - 20.02.2021, 13:41:28   [NestApplication] Nest application successfully started +23721ms
Run Code Online (Sandbox Code Playgroud)

大约过了 24 秒,Nest 才宣布它已成功启动。我见过的其他 NestJs 项目上没有发生这种延迟。

事情应该是这样的吗?你知道在哪里/如何进一步分析 Nest 在这 20 到 30 年间所做的事情吗?