Skip to content

Commit

Permalink
Support multiple streamIds in the process-stream script (#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrrikkotua authored Jul 18, 2023
1 parent 4391711 commit 38eaecd
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions services/apps/integration_stream_worker/src/bin/process-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (processArguments.length !== 1) {
process.exit(1)
}

const streamId = processArguments[0]
const streamIds = processArguments[0].split(',')

setImmediate(async () => {
const sqsClient = getSqsClient(SQS_CONFIG())
Expand All @@ -25,16 +25,18 @@ setImmediate(async () => {
const store = new DbStore(log, dbConnection)
const repo = new IntegrationStreamRepository(store, log)

const info = await repo.getStreamData(streamId)
for (const streamId of streamIds) {
const info = await repo.getStreamData(streamId)

if (info) {
if (info.state !== IntegrationStreamState.PENDING) {
await repo.resetStream(streamId)
}
if (info) {
if (info.state !== IntegrationStreamState.PENDING) {
await repo.resetStream(streamId)
}

await emitter.triggerStreamProcessing(info.tenantId, info.integrationType, streamId)
} else {
log.error({ streamId }, 'Stream not found!')
process.exit(1)
await emitter.triggerStreamProcessing(info.tenantId, info.integrationType, streamId)
} else {
log.error({ streamId }, 'Stream not found!')
process.exit(1)
}
}
})

0 comments on commit 38eaecd

Please sign in to comment.