Skip to content
New issue

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

Prevented duplicate "request completed" logs #63

Merged

Conversation

chrismeyers
Copy link
Contributor

I noticed that two "request completed" logs were being printed by my Fastify instance following the "incoming request" log. After setting some breakpoints, I narrowed down the cause of this behavior to this plugin, specifically the onResponse hook controlled by the disposeOnResponse option. Removing the return from the hook callback stopped the extra log from being printed. Alternatively, using async/await will also fix this problem.

Checklist

Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding a test case?

lib/fastifyAwilixPlugin.js Outdated Show resolved Hide resolved
lib/fastifyAwilixPlugin.js Outdated Show resolved Hide resolved
@chrismeyers
Copy link
Contributor Author

Hi @Eomm, thanks for taking a look at this! I added a few tests cases to verify the logging is correct. Let me know if you need anything else.

@Eomm Eomm requested a review from a team March 10, 2022 08:31
Copy link
Member

@zekth zekth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✌️

Copy link
Member

@darkgl0w darkgl0w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina
Copy link
Member

@kibertoad would you like to land and release this?

@chrismeyers
Copy link
Contributor Author

Hey, just checking in on when this is planned to be merged and released. Thanks!

@zekth
Copy link
Member

zekth commented Mar 20, 2022

kind reminder @kibertoad

@kibertoad
Copy link
Member

Sorry, missed this. On it.

@kibertoad kibertoad merged commit 6ce56ac into fastify:main Mar 20, 2022
@kibertoad
Copy link
Member

Released in 1.2.1

@chrismeyers chrismeyers deleted the bug/duplicate-request-completed-logs branch March 20, 2022 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants