Skip to content

Commit

Permalink
Fix error when _shutdownStatsbeat gets called while being undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mkayander committed Jan 10, 2024
1 parent 9c10cd3 commit 6ee72c4
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 6ee72c4

Please sign in to comment.