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

Commit

Permalink
honor read timeout when querying bigtable store
Browse files Browse the repository at this point in the history
  • Loading branch information
woodsaj committed Oct 15, 2018
1 parent 05497b9 commit 45690e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion store/bigtable/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ func (s *Store) Search(ctx context.Context, key schema.AMKey, ttl, start, end ui
var err error
rowCount := 0
pre = time.Now()
reqErr := s.tbl.ReadRows(ctx, rr, func(row bigtable.Row) bool {
queryCtx, cancel := context.WithTimeout(ctx, s.cfg.ReadTimeout)
reqErr := s.tbl.ReadRows(queryCtx, rr, func(row bigtable.Row) bool {
rowCount++
chunks := 0
var itgen *chunk.IterGen
Expand Down Expand Up @@ -448,6 +449,7 @@ func (s *Store) Search(ctx context.Context, key schema.AMKey, ttl, start, end ui

return true
}, bigtable.RowFilter(filter))
cancel()
btblRowsPerResponse.Value(rowCount)
btblGetExecDuration.Value(time.Since(pre))

Expand Down

0 comments on commit 45690e3

Please sign in to comment.