fix: improve context handling in projections (#3638)

* fix: improve context handling in projections

* fix tests

* use as of system time for current sequence

* use as of system time for current sequence

Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
Livio Amstutz
2022-05-19 10:25:19 +02:00
committed by GitHub
parent ed0aa7088b
commit c71ccc8a80
7 changed files with 47 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
package crdb
import (
"context"
"database/sql"
"strconv"
"strings"
@@ -21,8 +22,8 @@ type instanceSequence struct {
sequence uint64
}
func (h *StatementHandler) currentSequences(query func(string, ...interface{}) (*sql.Rows, error)) (currentSequences, error) {
rows, err := query(h.currentSequenceStmt, h.ProjectionName)
func (h *StatementHandler) currentSequences(ctx context.Context, query func(context.Context, string, ...interface{}) (*sql.Rows, error)) (currentSequences, error) {
rows, err := query(ctx, h.currentSequenceStmt, h.ProjectionName)
if err != nil {
return nil, err
}