mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat(server): graceful shutdown for AI streams (#10025)
https://github.com/user-attachments/assets/8dd3c4f5-4059-4f03-9f51-68078d7ab5c4
This commit is contained in:
@@ -44,6 +44,11 @@ export async function createApp() {
|
||||
app.useGlobalInterceptors(app.get(CacheInterceptor));
|
||||
app.useGlobalFilters(new GlobalExceptionFilter(app.getHttpAdapter()));
|
||||
app.use(cookieParser());
|
||||
// only enable shutdown hooks in production
|
||||
// https://docs.nestjs.com/fundamentals/lifecycle-events#application-shutdown
|
||||
if (AFFiNE.NODE_ENV === 'production') {
|
||||
app.enableShutdownHooks();
|
||||
}
|
||||
|
||||
const adapter = new SocketIoAdapter(app);
|
||||
app.useWebSocketAdapter(adapter);
|
||||
|
||||
Reference in New Issue
Block a user