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

Fix error when _shutdownStatsbeat gets called while being undefined #1259

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

mkayander
Copy link

@mkayander mkayander commented Jan 10, 2024

This PR fixes #1258 issue, a _shutdownStatsbeat function should not be called if it is undefined.

The constructor parameter is optional, however, the according class property is not.
There is a nullability check in one of the methods, but not in the res.on("end", ... handler. This causes errors when the callback is not provided.

I've made the class property type nullable as well for convenience, but unfortunately, TS strict mode is turned off in this project. As a result, that kind of nullability issues are not caught by TS.

Copy link
Contributor

@JacksonWeber JacksonWeber left a comment

Choose a reason for hiding this comment

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

LGTM

@JacksonWeber JacksonWeber self-requested a review January 11, 2024 00:28
@JacksonWeber
Copy link
Contributor

Looks good, and makes sense that we need to fix the case where that function could be undefined. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants