Skip to content

Commit

Permalink
Merge pull request #518 from meetqy/517-fastifyerror-fastify-instance…
Browse files Browse the repository at this point in the history
…-is-already-listening-cannot-add-route

fix: #517
  • Loading branch information
meetqy authored Nov 22, 2023
2 parents 4051888 + f4342eb commit e408722
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions apps/electron/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,15 @@ app.on("before-quit", (e) => {
});

app.on("quit", () => {
// 关闭静态服务器
void closeServer();
void prisma.$disconnect();
void (async () => {
// 关闭静态服务器
await closeServer();
await prisma.$disconnect();

if (PLATFORM != "darwin") {
app.quit();
}
if (PLATFORM != "darwin") {
app.quit();
}
})();
});

// In this file you can include the rest of your app"s specific main process
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { startClientServer } from "./client";
import { startMainServer } from "./main";
import { closeClientServer, startClientServer } from "./client";
import { closeMainServer, startMainServer } from "./main";

export * from "./main";
export * from "./client";
Expand All @@ -10,5 +10,5 @@ export const startServer = async () => {
};

export const closeServer = async () => {
await Promise.all([startMainServer(), startClientServer()]);
await Promise.all([closeClientServer(), closeMainServer()]);
};

0 comments on commit e408722

Please sign in to comment.