Skip to content

Commit

Permalink
fix: ErrorDetails calls
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jun 28, 2024
1 parent 5f40dea commit 25b09a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jobs/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/flanksource/duty"
"github.com/flanksource/duty/db"
"github.com/flanksource/duty/job"
)

Expand Down Expand Up @@ -86,16 +86,16 @@ var CleanupConfigItems = &job.Job{

var prevCount int64
if err := ctx.DB().Raw("SELECT COUNT(*) FROM config_items").Scan(&prevCount).Error; err != nil {
return fmt.Errorf("failed to count config items: %w", duty.DBErrorDetails(err))
return fmt.Errorf("failed to count config items: %w", db.ErrorDetails(err))
}

if err := ctx.DB().Exec("SELECT delete_old_config_items(?)", days).Error; err != nil {
return fmt.Errorf("failed to delete config items: %w", duty.DBErrorDetails(err))
return fmt.Errorf("failed to delete config items: %w", db.ErrorDetails(err))
}

var newCount int64
if err := ctx.DB().Raw("SELECT COUNT(*) FROM config_items").Scan(&newCount).Error; err != nil {
return fmt.Errorf("failed to count config items: %w", duty.DBErrorDetails(err))
return fmt.Errorf("failed to count config items: %w", db.ErrorDetails(err))
}
ctx.History.SuccessCount = int(newCount - prevCount)
return nil
Expand Down

0 comments on commit 25b09a4

Please sign in to comment.