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

All the warnings are either "fire once" or "unlimited" based on the flag passed to last "create" method #88

Closed
IMalyugin opened this issue Nov 17, 2023 · 3 comments · Fixed by #89
Labels
bug Something isn't working

Comments

@IMalyugin
Copy link

IMalyugin commented Nov 17, 2023

Basically, due to this piece of code:

Object.assign(opts, { unlimited })

The last created warning decides wether all the created warnings are limited or unlimited. Thus in fastify, since last created warning is made unlimited:
https://github.com/fastify/fastify/blob/99a405a4e347629595ac5062c74d91675b1b34e5/lib/warnings.js#L58

warning.create('FastifyWarning', 'FSTWRN002', 'The %s plugin being registered mixes async and callback styles, which will result in an error in `fastify@5`', { unlimited: true })

All the declared warnings are spamming the application :)

Should either move opts inside "create" or add a new hashmap for the unlimited flag

@Uzlopak Uzlopak added the bug Something isn't working label Nov 17, 2023
@Uzlopak
Copy link
Contributor

Uzlopak commented Nov 17, 2023

Yes, makes sense.

@Uzlopak
Copy link
Contributor

Uzlopak commented Nov 17, 2023

@jsumners

@jsumners
Copy link
Member

I saw this in the code a couple weeks ago. It wasn't clear to me if it would show as an issue or not. But clearly it does. A PR should be created that does not overwrite the global options with each new warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants