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

Fixed MaxListenersExceededWarning when creating many progress bars. #125

Closed
wants to merge 2 commits into from

Conversation

TychoTheTaco
Copy link

When you create many progress bars (>10), eventually you will get MaxListenersExceededWarning since SIGINT and SIGTERM listeners keep getting added in the constructor but are never removed. I fixed it by adding them on start()/create() and removing them on stop()

@AndiDittrich
Copy link
Member

Hi @TychoTheTaco

thanks for your contribution. Indeed that' a possible trap within the current implementation which was not tested - sry.
You solution may cause other issues by adding multiple handlers to the event stack, therefore it requires some modification before merging

@TychoTheTaco
Copy link
Author

I've added a check to make sure the callback only gets added if the bar is starting for the first time.

@AndiDittrich
Copy link
Member

i've applied a slightly modified version of your patch

dividedmind added a commit to getappmap/appmap-js that referenced this pull request Jan 15, 2023
This is to fix MaxListenersExceededWarning in tests.
See: npkgz/cli-progress#125
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.

None yet

2 participants