func (r *RouteRegistry) Lookup(uri route.Uri) *route.Pool { started := time.Now() r.RLock() uri = uri.RouteKey() var err error pool := r.byUri.MatchUri(uri) for pool == nil && err == nil { uri, err = uri.NextWildcard() pool = r.byUri.MatchUri(uri) } r.RUnlock() endLookup := time.Now() r.reporter.CaptureLookupTime(endLookup.Sub(started)) return pool }