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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Sender {

private _config: Config;
private _isStatsbeatSender: boolean;
private _shutdownStatsbeat: () => void;
private _shutdownStatsbeat?: () => void;
private _failedToIngestCounter: number;
private _statsbeatHasReachedIngestionAtLeastOnce: boolean;
private _statsbeat: Statsbeat;
Expand Down Expand Up @@ -200,7 +200,7 @@ class Sender {
this._numConsecutiveFailures = 0;
if (responseString.includes(INVALID_IKEY) && res.statusCode === 400) {
Logging.warn("Instrumentation key was invalid, please check the iKey");
this._shutdownStatsbeat();
this._shutdownStatsbeat?.();
}
// Handling of Statsbeat instance sending data, should turn it off if is not able to reach ingestion endpoint
if (this._isStatsbeatSender && !this._statsbeatHasReachedIngestionAtLeastOnce) {
Expand Down
Loading