1
0
Fork 0

Add Leader check to /db/request with NONE

master
Philip O'Toole 8 months ago committed by GitHub
parent 84bc4c9e6f
commit 007f07c09e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1177,7 +1177,8 @@ func (s *Store) Request(eqr *proto.ExecuteQueryRequest) ([]*proto.ExecuteQueryRe
}
if eqr.Level == proto.QueryRequest_QUERY_REQUEST_LEVEL_NONE {
if eqr.Freshness > 0 && time.Since(s.raft.LastContact()).Nanoseconds() > eqr.Freshness {
if s.raft.State() != raft.Leader && eqr.Freshness > 0 &&
time.Since(s.raft.LastContact()).Nanoseconds() > eqr.Freshness {
return nil, ErrStaleRead
}
qr, err := s.db.Query(eqr.Request, eqr.Timings)

Loading…
Cancel
Save