Skip to content

Commit

Permalink
feat: use last runtime on the checks from the check statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe authored and moshloop committed May 2, 2024
1 parent 950b06d commit 4389e82
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -20,7 +20,7 @@ require (
github.com/fergusstrange/embedded-postgres v1.25.0
github.com/flanksource/artifacts v1.0.4
github.com/flanksource/commons v1.22.1
github.com/flanksource/duty v1.0.441
github.com/flanksource/duty v1.0.442
github.com/flanksource/gomplate/v3 v3.24.7
github.com/flanksource/is-healthy v1.0.6
github.com/flanksource/kommons v0.31.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -858,8 +858,8 @@ github.com/flanksource/artifacts v1.0.4 h1:KjQTwsvQ73uHqTK7o4Jwt/RW8fyxJOTJ6JLgz
github.com/flanksource/artifacts v1.0.4/go.mod h1:wkbdseaTkDo4Q6k6T86vXd4Uy47M6NPCmexgHvCTDl0=
github.com/flanksource/commons v1.22.1 h1:Ycg8r26bx537UTdAEFgngDW1r2j5bX6Lr3NGxLICpiw=
github.com/flanksource/commons v1.22.1/go.mod h1:GD5+yGvmYFPIW3WMNN+y1JkeDMJY74e05pQAsRbrvwY=
github.com/flanksource/duty v1.0.441 h1:4srUr5jcce9Q0/s7M2cCRyur5DSeSS+HOtC57QrD4DY=
github.com/flanksource/duty v1.0.441/go.mod h1:eF0Z6vZ2vSO1vy8HDYMc+OkhGWx4Pg5+P16gUuL8+oI=
github.com/flanksource/duty v1.0.442 h1:UCqZDteQJfWYN3c5HNuuaMCpaQAqa3eejn5oXlRjUJY=
github.com/flanksource/duty v1.0.442/go.mod h1:eF0Z6vZ2vSO1vy8HDYMc+OkhGWx4Pg5+P16gUuL8+oI=
github.com/flanksource/gomplate/v3 v3.20.4/go.mod h1:27BNWhzzSjDed1z8YShO6W+z6G9oZXuxfNFGd/iGSdc=
github.com/flanksource/gomplate/v3 v3.24.7 h1:XVIwcOTIR9l95D+jaerHcqRFN2Mo6MNEMttxsEsZ9aY=
github.com/flanksource/gomplate/v3 v3.24.7/go.mod h1:7SJHGdFITvw3I8qf/ppF1BXbL2/ENyI5vpQkWt8MHtU=
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-schemas/go.mod
Expand Up @@ -51,7 +51,7 @@ require (
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/exaring/otelpgx v0.5.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flanksource/duty v1.0.441 // indirect
github.com/flanksource/duty v1.0.442 // indirect
github.com/flanksource/is-healthy v1.0.6 // indirect
github.com/flanksource/kommons v0.31.4 // indirect
github.com/flanksource/kubectl-neat v1.0.4 // indirect
Expand Down
4 changes: 2 additions & 2 deletions hack/generate-schemas/go.sum
Expand Up @@ -735,8 +735,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flanksource/commons v1.22.1 h1:Ycg8r26bx537UTdAEFgngDW1r2j5bX6Lr3NGxLICpiw=
github.com/flanksource/commons v1.22.1/go.mod h1:GD5+yGvmYFPIW3WMNN+y1JkeDMJY74e05pQAsRbrvwY=
github.com/flanksource/duty v1.0.441 h1:4srUr5jcce9Q0/s7M2cCRyur5DSeSS+HOtC57QrD4DY=
github.com/flanksource/duty v1.0.441/go.mod h1:eF0Z6vZ2vSO1vy8HDYMc+OkhGWx4Pg5+P16gUuL8+oI=
github.com/flanksource/duty v1.0.442 h1:UCqZDteQJfWYN3c5HNuuaMCpaQAqa3eejn5oXlRjUJY=
github.com/flanksource/duty v1.0.442/go.mod h1:eF0Z6vZ2vSO1vy8HDYMc+OkhGWx4Pg5+P16gUuL8+oI=
github.com/flanksource/gomplate/v3 v3.20.4/go.mod h1:27BNWhzzSjDed1z8YShO6W+z6G9oZXuxfNFGd/iGSdc=
github.com/flanksource/gomplate/v3 v3.24.7 h1:XVIwcOTIR9l95D+jaerHcqRFN2Mo6MNEMttxsEsZ9aY=
github.com/flanksource/gomplate/v3 v3.24.7/go.mod h1:7SJHGdFITvw3I8qf/ppF1BXbL2/ENyI5vpQkWt8MHtU=
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/postgres.go
Expand Up @@ -78,7 +78,7 @@ func (c *postgresCache) AddCheckStatus(db *gorm.DB, check pkg.Check, status pkg.
if c.DB().Model(&checks).
Clauses(clause.Returning{Columns: []clause.Column{{Name: "id"}}}).
Where("canary_id = ? AND type = ? AND name = ?", check.CanaryID, check.Type, check.GetName()).
Updates(map[string]any{"status": check.Status, "labels": check.Labels, "last_runtime": time.Now(), "next_runtime": nextRuntime}).Error != nil {
Updates(map[string]any{"status": check.Status, "labels": check.Labels, "last_runtime": status.Time, "next_runtime": nextRuntime}).Error != nil {
logger.Errorf("error updating check: %v", err)
return
}
Expand Down

0 comments on commit 4389e82

Please sign in to comment.