From 22661fe9a30b0d0f06e4dc3f676ef497839884f6 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 17 Aug 2022 14:35:33 -0700 Subject: [PATCH] Diagnostic events error handling. --- server-sdk-common/src/events/EventProcessor.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server-sdk-common/src/events/EventProcessor.ts b/server-sdk-common/src/events/EventProcessor.ts index 87770b7102..6d086ad529 100644 --- a/server-sdk-common/src/events/EventProcessor.ts +++ b/server-sdk-common/src/events/EventProcessor.ts @@ -137,7 +137,7 @@ export default class EventProcessor implements LDEventProcessor { if (this.diagnosticsManager) { const initEvent = diagnosticsManager!.createInitEvent(); - this.tryPostingEvents(initEvent, this.diagnosticEventsUri, undefined, true); + this.postDiagnosticEvent(initEvent); this.diagnosticsTimer = setInterval(() => { const statsEvent = this.diagnosticsManager!.createStatsEventAndReset( @@ -149,11 +149,15 @@ export default class EventProcessor implements LDEventProcessor { this.droppedEvents = 0; this.deduplicatedUsers = 0; - this.tryPostingEvents(statsEvent, this.diagnosticEventsUri, undefined, true); + this.postDiagnosticEvent(statsEvent); }, config.diagnosticRecordingInterval * 1000); } } + private postDiagnosticEvent(event: DiagnosticInitEvent | DiagnosticStatsEvent) { + this.tryPostingEvents(event, this.diagnosticEventsUri, undefined, true).catch(() => {}); + } + close() { clearInterval(this.flushTimer); clearInterval(this.flushUsersTimer);