mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 04:07:31 +00:00
fix(storage): resolve deadlock occuring durring projection (#3671)
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package repository
|
||||
|
||||
import "github.com/zitadel/zitadel/internal/errors"
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
)
|
||||
|
||||
//SearchQuery defines the which and how data are queried
|
||||
type SearchQuery struct {
|
||||
@@ -8,6 +12,7 @@ type SearchQuery struct {
|
||||
Limit uint64
|
||||
Desc bool
|
||||
Filters [][]*Filter
|
||||
Tx *sql.Tx
|
||||
}
|
||||
|
||||
//Columns defines which fields of the event are needed for the query
|
||||
|
@@ -47,7 +47,15 @@ func query(ctx context.Context, criteria querier, searchQuery *repository.Search
|
||||
|
||||
query = criteria.placeholder(query)
|
||||
|
||||
rows, err := criteria.db().QueryContext(ctx, query, values...)
|
||||
var contextQuerier interface {
|
||||
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
|
||||
}
|
||||
contextQuerier = criteria.db()
|
||||
if searchQuery.Tx != nil {
|
||||
contextQuerier = searchQuery.Tx
|
||||
}
|
||||
|
||||
rows, err := contextQuerier.QueryContext(ctx, query, values...)
|
||||
if err != nil {
|
||||
logging.New().WithError(err).Info("query failed")
|
||||
return z_errors.ThrowInternal(err, "SQL-KyeAx", "unable to filter events")
|
||||
|
Reference in New Issue
Block a user