diff --git a/cmd/osbuild-composer-dbjobqueue-tests/main_test.go b/cmd/osbuild-composer-dbjobqueue-tests/main_test.go index 29ec66f852..35b7c26722 100644 --- a/cmd/osbuild-composer-dbjobqueue-tests/main_test.go +++ b/cmd/osbuild-composer-dbjobqueue-tests/main_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration package main diff --git a/pkg/jobqueue/dbjobqueue/dbjobqueue.go b/pkg/jobqueue/dbjobqueue/dbjobqueue.go index e59d4f629c..02dfc5c490 100644 --- a/pkg/jobqueue/dbjobqueue/dbjobqueue.go +++ b/pkg/jobqueue/dbjobqueue/dbjobqueue.go @@ -182,7 +182,8 @@ func (q *DBJobQueue) listen(ctx context.Context, ready chan<- struct{}) { panic(fmt.Errorf("error connecting to database: %v", err)) } defer func() { - _, err := conn.Exec(ctx, sqlUnlisten) + // use the empty context as the listening context is already cancelled at this point + _, err := conn.Exec(context.Background(), sqlUnlisten) if err != nil && !errors.Is(err, context.DeadlineExceeded) { logrus.Error("Error unlistening for jobs in dequeue: ", err) }