Skip to content

Commit

Permalink
style: Minor formatting changes
Browse files Browse the repository at this point in the history
Signed-off-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mahendrapaipuri committed Jan 7, 2024
1 parent f57d56a commit 1db495d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/jobstats/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,10 @@ func (j *jobStatsDB) getJobStats(startTime, endTime time.Time) error {

// Set pragma statements
j.setPragmaDirectives()

// Make prepare statement and defer closing statement
stmt, err := j.prepareInsertStatement(tx)
defer stmt.Close()

Check failure on line 447 in pkg/jobstats/db/db.go

View workflow job for this annotation

GitHub Actions / lint

SA5001: should check returned error before deferring stmt.Close() (staticcheck)

Check failure on line 447 in pkg/jobstats/db/db.go

View workflow job for this annotation

GitHub Actions / lint

SA5001: should check returned error before deferring stmt.Close() (staticcheck)
if err != nil {
level.Error(j.logger).Log("msg", "Failed to prepare insert job statement in DB", "err", err)
return err
Expand Down Expand Up @@ -478,9 +481,6 @@ func (j *jobStatsDB) getJobStats(startTime, endTime time.Time) error {
j.deleteTimeSeries(ignoredJobs)
level.Debug(j.logger).Log("msg", "Finished deleting time series in Prometheus")
}

// Defer Closing the database
defer stmt.Close()
return nil
}

Expand Down

0 comments on commit 1db495d

Please sign in to comment.