Skip to content

Commit

Permalink
fix: job schedule for CleanupCRDDeletedCanaries
Browse files Browse the repository at this point in the history
ERR [CleanupCRDDeletedCanaries] failed to schedule job: failed to parse duration @every 1d: time: unknown unit "d" in duration "1d"
  • Loading branch information
adityathebe committed Oct 18, 2024
1 parent 5e86ae5 commit 5eea1f5
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pkg/jobs/canary/canary_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,15 @@ func (j CanaryJob) Run(ctx dutyjob.JobRuntime) error {
for _, checkID := range checkIDsToRemove {
switch checkIDDeleteStrategyMap[checkID] {
case v1.OnTransformMarkHealthy:
checkDeleteStrategyGroup[models.CheckStatusHealthy] = append(checkDeleteStrategyGroup[models.CheckStatusHealthy], checkID)
checkDeleteStrategyGroup[models.CheckStatusHealthy] = append(
checkDeleteStrategyGroup[models.CheckStatusHealthy],
checkID,
)
case v1.OnTransformMarkUnhealthy:
checkDeleteStrategyGroup[models.CheckStatusUnhealthy] = append(checkDeleteStrategyGroup[models.CheckStatusUnhealthy], checkID)
checkDeleteStrategyGroup[models.CheckStatusUnhealthy] = append(
checkDeleteStrategyGroup[models.CheckStatusUnhealthy],
checkID,
)
}
}

Expand Down Expand Up @@ -175,7 +181,11 @@ func SaveResults(ctx context.Context, results []*pkg.CheckResult) ([]string, map
defer tx.Rollback()

for _, result := range results {
transformedChecksAdded, err := cache.PostgresCache.Add(ctx.WithDB(tx, ctx.Pool()), pkg.FromV1(result.Canary, result.Check), pkg.CheckStatusFromResult(*result))
transformedChecksAdded, err := cache.PostgresCache.Add(
ctx.WithDB(tx, ctx.Pool()),
pkg.FromV1(result.Canary, result.Check),
pkg.CheckStatusFromResult(*result),
)
if err != nil {
return nil, nil, fmt.Errorf("error adding check to cache: %w", err)
}
Expand All @@ -200,7 +210,7 @@ func logIfError(err error, description string) {

var CleanupCRDDeleteCanaries = &dutyjob.Job{
Name: "CleanupCRDDeletedCanaries",
Schedule: "@every 1d",
Schedule: "@every 24h",
RunNow: true,
Singleton: true,
JobHistory: true,
Expand All @@ -218,7 +228,8 @@ var CleanupCRDDeleteCanaries = &dutyjob.Job{
return nil
}

canaryClient, err := ctx.KubernetesDynamicClient().GetClientByGroupVersionKind(v1.GroupVersion.Group, v1.GroupVersion.Version, "Canary")
canaryClient, err := ctx.KubernetesDynamicClient().
GetClientByGroupVersionKind(v1.GroupVersion.Group, v1.GroupVersion.Version, "Canary")
if err != nil {
return fmt.Errorf("failed to get kubernetes client for canaries: %w", err)
}
Expand Down

0 comments on commit 5eea1f5

Please sign in to comment.