Skip to content

Commit

Permalink
Fix issue 57 - remove const vbeReloadLength
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoPeri committed Jan 25, 2021
1 parent 6d3f0ae commit feb6172
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions varnish.go
Expand Up @@ -16,8 +16,7 @@ import (
)

const (
vbeReload = "VBE.reload_"
vbeReloadLength = len(vbeReload)
vbeReload = "VBE.reload_"
)

var (
Expand Down Expand Up @@ -231,7 +230,7 @@ func findMostRecentVbeReloadPrefix(countersJSON map[string]interface{}) string {
for vName, _ := range countersJSON {
// Checking only the required ".happy" stat
if strings.HasPrefix(vName, vbeReload) && strings.HasSuffix(vName, ".happy") {
dotAfterPrefixIndex := vbeReloadLength + strings.Index(vName[vbeReloadLength:], ".")
dotAfterPrefixIndex := len(vbeReload) + strings.Index(vName[len(vbeReload):], ".")
vbeReloadPrefix := vName[:dotAfterPrefixIndex]
if strings.Compare(vbeReloadPrefix, mostRecentVbeReloadPrefix) > 0 {
mostRecentVbeReloadPrefix = vbeReloadPrefix
Expand Down

0 comments on commit feb6172

Please sign in to comment.