Skip to content

Commit

Permalink
[O2B-1418] Improve runs start/stop extraction from kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboulais committed Dec 16, 2024
1 parent 5dafb0e commit 2b73920
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/server/kafka/AliEcsSynchronizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Check warning on line 75 in lib/server/kafka/AliEcsSynchronizer.js

View check run for this annotation

Codecov / codecov/patch

lib/server/kafka/AliEcsSynchronizer.js#L75

Added line #L75 was not covered by tests
const { externalId: externalUserId, name: userName } = lastRequestUser ?? {};

if (state === 'CONFIGURED' && transition === 'START_ACTIVITY') {
if (transition === 'START_ACTIVITY') {

Check warning on line 78 in lib/server/kafka/AliEcsSynchronizer.js

View check run for this annotation

Codecov / codecov/patch

lib/server/kafka/AliEcsSynchronizer.js#L78

Added line #L78 was not covered by tests
runService
.createOrUpdate(
runNumber,
Expand All @@ -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') {

Check warning on line 89 in lib/server/kafka/AliEcsSynchronizer.js

View check run for this annotation

Codecov / codecov/patch

lib/server/kafka/AliEcsSynchronizer.js#L89

Added line #L89 was not covered by tests
runService
.createOrUpdate(
runNumber,
Expand Down

0 comments on commit 2b73920

Please sign in to comment.