diff --git a/.changelog/_3729.txt b/.changelog/_3729.txt new file mode 100644 index 000000000..6032c69ed --- /dev/null +++ b/.changelog/_3729.txt @@ -0,0 +1,3 @@ +```release-note:bug +namespace: **(Enterprise Only)** Fix a bug that caused blocking queries during namespace replication to timeout +``` \ No newline at end of file diff --git a/internal/tools/proto-gen-rpc-glue/main.go b/internal/tools/proto-gen-rpc-glue/main.go index f66118cfc..865fce973 100644 --- a/internal/tools/proto-gen-rpc-glue/main.go +++ b/internal/tools/proto-gen-rpc-glue/main.go @@ -595,6 +595,16 @@ func (msg *%[1]s) AllowStaleRead() bool { return msg.%[2]s.AllowStaleRead() } +// BlockingTimeout implements pool.BlockableQuery +func (msg *%[1]s) BlockingTimeout(maxQueryTime, defaultQueryTime time.Duration) time.Duration { + maxTime := structs.DurationFromProto(msg.%[2]s.GetMaxQueryTime()) + o := structs.QueryOptions{ + MaxQueryTime: maxTime, + MinQueryIndex: msg.%[2]s.GetMinQueryIndex(), + } + return o.BlockingTimeout(maxQueryTime, defaultQueryTime) +} + // HasTimedOut implements structs.RPCInfo func (msg *%[1]s) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) { if msg == nil || msg.%[2]s == nil {