Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: adapt new abort behavior (#10622)

darkskygit0b8fa7904d03
diff --git a/packages/backend/server/src/plugins/copilot/controller.ts b/packages/backend/server/src/plugins/copilot/controller.ts
index 61203648d6..658a3d2b2c 100644
--- a/packages/backend/server/src/plugins/copilot/controller.ts
+++ b/packages/backend/server/src/plugins/copilot/controller.ts
@@ -175,7 +175,11 @@ export class CopilotController implements BeforeApplicationShutdown {
private getSignal(req: Request) {
const controller = new AbortController();
- req.on('close', () => controller.abort());
+ req.socket.on('close', hasError => {
+ if (hasError) {
+ controller.abort();
+ }
+ });
return controller.signal;
}