mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-02 11:56:02 +02:00
use response record version
This commit is contained in:
parent
312a440329
commit
dd62c32739
1 changed files with 3 additions and 11 deletions
|
@ -37,18 +37,10 @@ func (q *cachingQuerier) Query(ctx context.Context, in *databroker.QueryRequest,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a minimum record version hint is sent, check to see if any of the records meets the minimum
|
// If a minimum record version hint is sent, check to see if the result meets the minimum
|
||||||
// record version and if not, invalidate the cache and re-query.
|
// record version and if not, invalidate the cache and re-query.
|
||||||
if in.MinimumRecordVersionHint != nil {
|
if in.MinimumRecordVersionHint != nil && res.RecordVersion < *in.MinimumRecordVersionHint {
|
||||||
found := false
|
q.InvalidateCache(ctx, in)
|
||||||
for _, r := range res.GetRecords() {
|
|
||||||
if r.GetVersion() >= *in.MinimumRecordVersionHint {
|
|
||||||
found = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
q.InvalidateCache(ctx, in)
|
|
||||||
}
|
|
||||||
res, err = q.query(ctx, in, opts...)
|
res, err = q.query(ctx, in, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Reference in a new issue