fix(sqlite): Add missing rows.Err() checks after row iteration (#1141)
The scanIssues and scanIssuesWithDependencyType helper functions were not checking rows.Err() after iterating through query results. This could cause errors during iteration (connection drops, context cancellation, etc.) to be silently ignored. Per Go database/sql best practices, rows.Err() should always be checked after a rows.Next() loop completes to catch any errors that occurred during iteration. Co-authored-by: Steven Syrek <steven.syrek@deepl.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1039,6 +1039,11 @@ func (s *SQLiteStorage) scanIssues(ctx context.Context, rows *sql.Rows) ([]*type
|
||||
issueIDs = append(issueIDs, issue.ID)
|
||||
}
|
||||
|
||||
// Check for errors during iteration (e.g., connection issues, context cancellation)
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, fmt.Errorf("error iterating issue rows: %w", err)
|
||||
}
|
||||
|
||||
// Second pass: batch-load labels for all issues
|
||||
labelsMap, err := s.GetLabelsForIssues(ctx, issueIDs)
|
||||
if err != nil {
|
||||
@@ -1180,5 +1185,10 @@ func (s *SQLiteStorage) scanIssuesWithDependencyType(ctx context.Context, rows *
|
||||
results = append(results, result)
|
||||
}
|
||||
|
||||
// Check for errors during iteration (e.g., connection issues, context cancellation)
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, fmt.Errorf("error iterating issue rows with dependency type: %w", err)
|
||||
}
|
||||
|
||||
return results, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user