Skip to content

Commit

Permalink
feat(zeebe): fix activate jobs stream
Browse files Browse the repository at this point in the history
  • Loading branch information
huygur authored and jwulf committed Jul 29, 2024
1 parent 70c9954 commit 68bb5da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/zeebe/zb/ZeebeGrpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,21 @@ export class ZeebeGrpcClient extends TypedEmitter<
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
try {
const jobs: ZB.Job<Variables, CustomHeaders>[] = []

const stream = await (await this.grpc).activateJobsStream(req)
stream.on('data', (res: Grpc.ActivateJobsResponse) => {
const jobs = res.jobs.map((job) =>
const parsedJobs = res.jobs.map((job) =>
parseVariablesAndCustomHeadersToJSON<Variables, CustomHeaders>(
job,
inputVariableDtoToUse,
customHeadersDtoToUse
)
)
jobs.push(...parsedJobs)
})

stream.on('end', () => {
resolve(jobs)
})
} catch (e: unknown) {
Expand Down

0 comments on commit 68bb5da

Please sign in to comment.