Skip to content

Commit

Permalink
fix(cdp): Check for error status before enqueueing (#24783)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored and MarconLP committed Sep 6, 2024
1 parent 75c5ea5 commit 4c9f612
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions plugin-server/src/cdp/cdp-consumers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,6 @@ abstract class CdpConsumerBase {
await Promise.all(
results.map(async (result) => {
// Tricky: We want to pull all the logs out as we don't want them to be passed around to any subsequent functions
if (result.finished || result.error) {
this.produceAppMetric({
team_id: result.invocation.teamId,
app_source_id: result.invocation.hogFunction.id,
metric_kind: result.error ? 'failure' : 'success',
metric_name: result.error ? 'failed' : 'succeeded',
count: 1,
})
}

this.produceLogs(result)

Expand All @@ -274,8 +265,16 @@ abstract class CdpConsumerBase {
})
}

if (!result.finished) {
// If it isn't finished then we need to put it back on the queue
if (result.finished || result.error) {
this.produceAppMetric({
team_id: result.invocation.teamId,
app_source_id: result.invocation.hogFunction.id,
metric_kind: result.error ? 'failure' : 'success',
metric_name: result.error ? 'failed' : 'succeeded',
count: 1,
})
} else {
// Means there is follow up so we enqueue it
await this.queueInvocation(result.invocation)
}
})
Expand Down

0 comments on commit 4c9f612

Please sign in to comment.