Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit 45690e3

Browse files
author
woodsaj
committed
honor read timeout when querying bigtable store
1 parent 05497b9 commit 45690e3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

store/bigtable/bigtable.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ func (s *Store) Search(ctx context.Context, key schema.AMKey, ttl, start, end ui
420420
var err error
421421
rowCount := 0
422422
pre = time.Now()
423-
reqErr := s.tbl.ReadRows(ctx, rr, func(row bigtable.Row) bool {
423+
queryCtx, cancel := context.WithTimeout(ctx, s.cfg.ReadTimeout)
424+
reqErr := s.tbl.ReadRows(queryCtx, rr, func(row bigtable.Row) bool {
424425
rowCount++
425426
chunks := 0
426427
var itgen *chunk.IterGen
@@ -448,6 +449,7 @@ func (s *Store) Search(ctx context.Context, key schema.AMKey, ttl, start, end ui
448449

449450
return true
450451
}, bigtable.RowFilter(filter))
452+
cancel()
451453
btblRowsPerResponse.Value(rowCount)
452454
btblGetExecDuration.Value(time.Since(pre))
453455

0 commit comments

Comments
 (0)