Skip to content

Commit

Permalink
We retrieved the run id during the first query so lets pass it into the
Browse files Browse the repository at this point in the history
update statement to speed up the update
  • Loading branch information
dehort committed Feb 27, 2024
1 parent 51254c7 commit b70a17e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/response-consumer/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ func (this *handler) onMessage(ctx context.Context, msg *k.Message) {
Events: eventsSerialized,
}

// We should have grabbed the run id (primary key) above...lets use it here during the update
baseQuery = baseQuery.Where("id = ?", run.ID)

// Only update if the run is not marked as complete
updateResult := baseQuery.Where("status not in ?", []string{db.RunStatusSuccess, db.RunStatusFailure}).Select("status", "events").Updates(toUpdate)
if updateResult.Error != nil {
Expand Down

0 comments on commit b70a17e

Please sign in to comment.