Skip to content

Commit

Permalink
Merge pull request #1554 from flanksource/set-resource-id-for-canary-…
Browse files Browse the repository at this point in the history
…sync

chore: set resource id for canary sync job
  • Loading branch information
yashmehrotra authored Jan 3, 2024
2 parents c7a1ebd + 9ca2420 commit 9cd884f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/jobs/canary/canary_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ func (j CanaryJob) GetNamespacedName() types.NamespacedName {
}

func (j CanaryJob) Run(ctx dutyjob.JobRuntime) error {
ctx.GetSpan().SetAttributes(attribute.String("canary-id", j.DBCanary.ID.String()))
if runner.IsCanaryIgnored(&j.Canary.ObjectMeta) {
return nil
}

canaryID := j.DBCanary.ID.String()
ctx.History.ResourceID = canaryID
ctx.History.ResourceType = "canary"
ctx.GetSpan().SetAttributes(attribute.String("canary-id", canaryID))

val, _ := concurrentJobLocks.LoadOrStore(canaryID, &sync.Mutex{})
lock, ok := val.(*sync.Mutex)
if !ok {
Expand Down

0 comments on commit 9cd884f

Please sign in to comment.