@@ -147,7 +147,7 @@ var statusCodes = map[string][]uint64{
147147 "capabilities" : make ([]uint64 , 5 ),
148148}
149149
150- // interface to retrive retention and aggregation
150+ // interface to retrieve retention and aggregation
151151// schema from persister.
152152type configRetriever interface {
153153 MetricRetentionPeriod (string ) (int , bool )
@@ -520,14 +520,14 @@ func (listener *CarbonserverListener) SetDoNotLog404s(doNotLog404s bool) {
520520func (listener * CarbonserverListener ) SetFailOnMaxGlobs (failOnMaxGlobs bool ) {
521521 listener .failOnMaxGlobs = failOnMaxGlobs
522522}
523- func (listener * CarbonserverListener ) SetMaxMetricsGlobbed (max int ) {
524- listener .maxMetricsGlobbed = max
523+ func (listener * CarbonserverListener ) SetMaxMetricsGlobbed (m int ) {
524+ listener .maxMetricsGlobbed = m
525525}
526- func (listener * CarbonserverListener ) SetMaxMetricsRendered (max int ) {
527- listener .maxMetricsRendered = max
526+ func (listener * CarbonserverListener ) SetMaxMetricsRendered (m int ) {
527+ listener .maxMetricsRendered = m
528528}
529- func (listener * CarbonserverListener ) SetMaxFetchDataGoroutines (max int ) {
530- listener .maxFetchDataGoroutines = max
529+ func (listener * CarbonserverListener ) SetMaxFetchDataGoroutines (m int ) {
530+ listener .maxFetchDataGoroutines = m
531531}
532532func (listener * CarbonserverListener ) SetFLock (flock bool ) {
533533 listener .flock = flock
@@ -637,8 +637,8 @@ func (listener *CarbonserverListener) ShouldThrottleMetric(ps *points.Points, in
637637
638638 return throttled
639639}
640- func (listener * CarbonserverListener ) SetMaxInflightRequests (max uint64 ) {
641- listener .MaxInflightRequests = max
640+ func (listener * CarbonserverListener ) SetMaxInflightRequests (m uint64 ) {
641+ listener .MaxInflightRequests = m
642642}
643643func (listener * CarbonserverListener ) SetNoServiceWhenIndexIsNotReady (no bool ) {
644644 listener .NoServiceWhenIndexIsNotReady = no
@@ -964,13 +964,14 @@ func (listener *CarbonserverListener) updateFileList(dir string, cacheMetricName
964964 readFromCache = true
965965 for {
966966 entry , err := flc .Read ()
967+ if errors .Is (err , io .EOF ) {
968+ break
969+ }
967970 if err != nil {
968- if ! errors .Is (err , io .EOF ) {
969- infos = append (infos , zap .NamedError ("file_list_cache_read_error" , err ))
971+ infos = append (infos , zap .NamedError ("file_list_cache_read_error" , err ))
970972
971- readFromCache = false
972- trieIdx = newTrie (".wsp" , listener .maxCreatesPerSecond , listener .estimateSize )
973- }
973+ readFromCache = false
974+ trieIdx = newTrie (".wsp" , listener .maxCreatesPerSecond , listener .estimateSize )
974975
975976 break
976977 }
@@ -1258,7 +1259,8 @@ func (listener *CarbonserverListener) updateFileList(dir string, cacheMetricName
12581259
12591260func (* CarbonserverListener ) logTrieInsertError (logger * zap.Logger , msg , metric string , err error ) {
12601261 zfields := []zap.Field {zap .Error (err ), zap .String ("metric" , metric )}
1261- if ierr , ok := err .(* trieInsertError ); ok {
1262+ var ierr * trieInsertError
1263+ if errors .As (err , & ierr ) {
12621264 zfields = append (zfields , zap .String ("err_info" , ierr .info ))
12631265 }
12641266 logger .Error (msg , zfields ... )
@@ -2053,13 +2055,13 @@ type GlobQueryRateLimiter struct {
20532055 maxInflightRequests chan struct {}
20542056}
20552057
2056- func NewGlobQueryRateLimiter (pattern string , max uint ) (* GlobQueryRateLimiter , error ) {
2058+ func NewGlobQueryRateLimiter (pattern string , m uint ) (* GlobQueryRateLimiter , error ) {
20572059 exp , err := regexp .Compile (pattern )
20582060 if err != nil {
20592061 return nil , err
20602062 }
20612063
2062- return & GlobQueryRateLimiter {pattern : exp , maxInflightRequests : make (chan struct {}, max )}, nil
2064+ return & GlobQueryRateLimiter {pattern : exp , maxInflightRequests : make (chan struct {}, m )}, nil
20632065}
20642066
20652067type ApiPerPathRatelimiter struct {
0 commit comments