Skip to content

Commit fc69684

Browse files
authoredFeb 5, 2025
Merge pull request #885 from supabase/close-both-apps
fix: Close both apps to allow for process restart
2 parents 8ad7e24 + 38e265d commit fc69684

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
 

‎src/server/admin-app.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { fastify, FastifyInstance, FastifyServerOptions } from 'fastify'
2-
3-
import FastifyMetrics from 'fastify-metrics'
2+
import fastifyMetrics from 'fastify-metrics'
43

54
export function build(opts: FastifyServerOptions = {}): FastifyInstance {
65
const app = fastify(opts)
7-
// @ts-ignore fastify-metrics doesn't work with NodeNext resolution
8-
app.register(FastifyMetrics, {
6+
app.register(fastifyMetrics.default, {
97
endpoint: '/metrics',
108
routeMetrics: { enabled: false },
119
})

‎src/server/server.ts

+6
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,15 @@ if (EXPORT_DOCS) {
158158
app.log.error(err)
159159
}
160160
await app.close()
161+
await adminApp.close()
161162
})
162163
app.addHook('onClose', async () => {
163164
closeListeners.uninstall()
165+
await adminApp.close()
166+
})
167+
adminApp.addHook('onClose', async () => {
168+
closeListeners.uninstall()
169+
await app.close()
164170
})
165171

166172
app.listen({ port: PG_META_PORT, host: PG_META_HOST }, (err) => {

0 commit comments

Comments
 (0)
Failed to load comments.