Skip to content

Commit

Permalink
prefetch immediately if matchers requires more data and if not alread…
Browse files Browse the repository at this point in the history
…y prefecthed (#239)
  • Loading branch information
WeidiDeng authored Aug 23, 2024
1 parent e23bce0 commit 22a0393
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions layer4/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ func (routes RouteList) Compile(logger *zap.Logger, matchingTimeout time.Duratio
if errors.Is(err, ErrConsumedAllPrefetchedBytes) {
lastNeedsMoreIdx = i
routesStatus[i] = routeNeedsMore
// the first time a matcher requires more data, exit the loop to force a prefetch
if !matcherNeedMore {
break
}
continue // ignore and try next route
}
if err != nil {
Expand Down

0 comments on commit 22a0393

Please sign in to comment.