From 55b7a162071416be6ffffd0434a8ac05a3096804 Mon Sep 17 00:00:00 2001 From: LeTamanoir Date: Thu, 2 Oct 2025 23:09:34 +0200 Subject: [PATCH 1/3] add await for stop --- src/adapter/bun/index.ts | 6 +++--- src/adapter/web-standard/index.ts | 2 +- src/index.ts | 6 +----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/adapter/bun/index.ts b/src/adapter/bun/index.ts index e8f43bbf..2d0d2eb4 100644 --- a/src/adapter/bun/index.ts +++ b/src/adapter/bun/index.ts @@ -381,9 +381,9 @@ export const BunAdapter: ElysiaAdapter = { if (callback) callback(app.server!) - process.on('beforeExit', () => { + process.on('beforeExit', async () => { if (app.server) { - app.server.stop?.() + await app.server.stop?.() app.server = null if (app.event.stop) @@ -416,7 +416,7 @@ export const BunAdapter: ElysiaAdapter = { }, async stop(app, closeActiveConnections) { if (app.server) { - app.server.stop(closeActiveConnections) + await app.server.stop(closeActiveConnections) app.server = null if (app.event.stop?.length) diff --git a/src/adapter/web-standard/index.ts b/src/adapter/web-standard/index.ts index 6d93ff9d..2a512cb3 100644 --- a/src/adapter/web-standard/index.ts +++ b/src/adapter/web-standard/index.ts @@ -66,7 +66,7 @@ export const WebStandardAdapter: ElysiaAdapter = { ) if (app.server) { - app.server.stop(closeActiveConnections) + await app.server.stop(closeActiveConnections) app.server = null if (app.event.stop?.length) diff --git a/src/index.ts b/src/index.ts index 6239e8cd..e64af09b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,11 +12,7 @@ import fastDecodeURIComponent from 'fast-decode-uri-component' import type { Context, PreContext } from './context' import { t } from './type-system' -import { - mergeInference, - sucrose, - type Sucrose -} from './sucrose' +import { mergeInference, sucrose, type Sucrose } from './sucrose' import type { WSLocalHook } from './ws/types' From 26c3601cb04fe89348f0aa722fd13bd8f21dc84f Mon Sep 17 00:00:00 2001 From: LeTamanoir Date: Thu, 2 Oct 2025 23:12:01 +0200 Subject: [PATCH 2/3] nit --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e64af09b..6239e8cd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,11 @@ import fastDecodeURIComponent from 'fast-decode-uri-component' import type { Context, PreContext } from './context' import { t } from './type-system' -import { mergeInference, sucrose, type Sucrose } from './sucrose' +import { + mergeInference, + sucrose, + type Sucrose +} from './sucrose' import type { WSLocalHook } from './ws/types' From b77abcd374ef694e19ff508a69ed3fe7a02e09e8 Mon Sep 17 00:00:00 2001 From: LeTamanoir Date: Thu, 2 Oct 2025 23:18:50 +0200 Subject: [PATCH 3/3] fix test --- test/ws/aot.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ws/aot.test.ts b/test/ws/aot.test.ts index 0ce34e73..9393cb8c 100644 --- a/test/ws/aot.test.ts +++ b/test/ws/aot.test.ts @@ -15,6 +15,6 @@ describe('WebSocket with AoT disabled', () => { await wsOpen(ws) await wsClosed(ws) - await app.stop() + await app.stop(true) }) })