Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions internal/scheduler/database/job_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@
AccessMode: pgx.ReadWrite,
DeferrableMode: pgx.Deferrable,
}, func(tx pgx.Tx) error {

Check failure on line 195 in internal/scheduler/database/job_repository.go

View workflow job for this annotation

GitHub Actions / lint / Lint Go

File is not properly formatted (gofumpt)
var rows pgx.Rows
var queryErr error
defer func() {
if rows != nil {
rows.Close()
}
}()

for _, chunk := range chunks {
tmpTable, err := insertRunIdsToTmpTable(ctx, tx, chunk)
if err != nil {
Expand All @@ -203,11 +212,10 @@
FROM %s as tmp
JOIN job_run_errors ON job_run_errors.run_id = tmp.run_id`

rows, err := tx.Query(ctx, fmt.Sprintf(query, tmpTable))
if err != nil {
return err
rows, queryErr = tx.Query(ctx, fmt.Sprintf(query, tmpTable))
if queryErr != nil {
return queryErr
}
defer rows.Close()
for rows.Next() {
var runId string
var errorBytes []byte
Expand All @@ -221,6 +229,8 @@
}
errorsByRunId[runId] = jobError
}

rows.Close()
}
return nil
})
Expand Down
Loading