fix(doctor): use context.Background() instead of nil in CheckDuplicateIssues
The nil context caused a panic during store.Close() in tests. Passing context.Background() fixes the test timeout issue.
This commit is contained in:
@@ -3,6 +3,7 @@ package doctor
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -191,7 +192,8 @@ func CheckDuplicateIssues(path string) DoctorCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open store to use existing duplicate detection
|
// Open store to use existing duplicate detection
|
||||||
store, err := sqlite.New(nil, dbPath)
|
ctx := context.Background()
|
||||||
|
store, err := sqlite.New(ctx, dbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return DoctorCheck{
|
return DoctorCheck{
|
||||||
Name: "Duplicate Issues",
|
Name: "Duplicate Issues",
|
||||||
@@ -201,7 +203,7 @@ func CheckDuplicateIssues(path string) DoctorCheck {
|
|||||||
}
|
}
|
||||||
defer func() { _ = store.Close() }()
|
defer func() { _ = store.Close() }()
|
||||||
|
|
||||||
issues, err := store.SearchIssues(nil, "", types.IssueFilter{})
|
issues, err := store.SearchIssues(ctx, "", types.IssueFilter{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return DoctorCheck{
|
return DoctorCheck{
|
||||||
Name: "Duplicate Issues",
|
Name: "Duplicate Issues",
|
||||||
|
|||||||
Reference in New Issue
Block a user