We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Awaiting on app.close() resolves before async onClose handlers are resolved
Steps to reproduce the behavior:
const avvio = require('avvio') const server = {} const app = avvio(server, { autostart: false }) async function start() { await server.use(async instance => { console.log('plugin 1 starting') await new Promise(resolve => setTimeout(resolve, 1000)) instance.onClose(async () => { console.log('plugin 1 stopping') await new Promise(resolve => setTimeout(resolve, 2000)) console.log('plugin 1 stopped') }) console.log('plugin 1 started') }, {}) await server.ready() console.log('app started') } start() setTimeout(async () => { console.log('app closing') await app.close() console.log('app closed') }, 5000)
The await app.close() call should not resolve until the registered plugin's onClose function is resolved
await app.close()
The output is:
plugin 1 starting plugin 1 started app started app closing plugin 1 stopping app closed plugin 1 stopped
whereas the expected output is:
plugin 1 starting plugin 1 started app started app closing plugin 1 stopping plugin 1 stopped app closed
The text was updated successfully, but these errors were encountered:
Would you like to send a Pull Request to address this issue? Remember to add unit tests.
Sorry, something went wrong.
fix: fastify#142 Awaiting on app.close() resolves before registered o…
8df7859
…nClose functions resolved
@mcollina sorry for the late reply, I think I fixed this issue. Please review my PR. thanks!
fix: #142 Awaiting on app.close() resolves before registered onClose …
b0a86d4
…functions resolved (#143)
Successfully merging a pull request may close this issue.
🐛 Bug Report
Awaiting on app.close() resolves before async onClose handlers are resolved
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The
await app.close()
call should not resolve until the registered plugin's onClose function is resolvedThe output is:
whereas the expected output is:
Your Environment
The text was updated successfully, but these errors were encountered: