Skip to content

Commit e91e59a

Browse files
committed
added a tiny timeout to let it shutdown properly
Signed-off-by: Matteo Collina <[email protected]>
1 parent 2fe3bc0 commit e91e59a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/plugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { readFile } from 'node:fs/promises'
22
import { basename } from 'node:path'
3+
import { setTimeout as sleep } from 'node:timers/promises'
34

45
const HTTP_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'TRACE']
56

@@ -28,6 +29,10 @@ export async function plugin (server, opts) {
2829
done(null, body)
2930
})
3031

32+
server.addHook('onClose', async () => {
33+
await sleep(100)
34+
})
35+
3136
for (const method of HTTP_METHODS) {
3237
server.route({
3338
method,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"homepage": "https://github.com/platformatic/php#readme",
3232
"dependencies": {
3333
"@fastify/static": "^8.2.0",
34-
"@platformatic/php-node": "1.0.1",
34+
"@platformatic/php-node": "1.0.2",
3535
"@platformatic/service": "^2.63.3",
3636
"json-schema-to-typescript": "^15.0.4"
3737
},

0 commit comments

Comments
 (0)