From 2b7392014818c1bc105d830dda830f6616cb4b80 Mon Sep 17 00:00:00 2001 From: Martin Boulais <31805063+martinboulais@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:17:20 +0100 Subject: [PATCH] [O2B-1418] Improve runs start/stop extraction from kafka --- lib/server/kafka/AliEcsSynchronizer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server/kafka/AliEcsSynchronizer.js b/lib/server/kafka/AliEcsSynchronizer.js index 7d0486e246..8ec4f73472 100644 --- a/lib/server/kafka/AliEcsSynchronizer.js +++ b/lib/server/kafka/AliEcsSynchronizer.js @@ -72,10 +72,10 @@ class AliEcsSynchronizer { this.ecsRunConsumer = new AliEcsEventMessagesConsumer(kafkaClient, RUN_CONSUMER_GROUP, RUN_TOPICS); this.ecsRunConsumer.onMessageReceived(async (eventMessage) => { - const { timestamp, runEvent: { environmentId, runNumber, state, transition, lastRequestUser } } = eventMessage; + const { timestamp, runEvent: { environmentId, runNumber, transition, lastRequestUser } } = eventMessage; const { externalId: externalUserId, name: userName } = lastRequestUser ?? {}; - if (state === 'CONFIGURED' && transition === 'START_ACTIVITY') { + if (transition === 'START_ACTIVITY') { runService .createOrUpdate( runNumber, @@ -86,7 +86,7 @@ class AliEcsSynchronizer { .catch((error) => this._logger.errorMessage(`Failed to save run start for ${runNumber}: ${error.message}`)); } - if (state === 'RUNNING' && transition === 'STOP_ACTIVITY') { + if (transition === 'STOP_ACTIVITY' || transition === 'GO_ERROR') { runService .createOrUpdate( runNumber,