Skip to content

Commit

Permalink
Merge pull request #434 from uprendis/feature/compatibility-go1.17
Browse files Browse the repository at this point in the history
Fix compatibility with go1.17
  • Loading branch information
uprendis authored Mar 8, 2023
2 parents d8df26a + 7a5c18d commit e585097
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/opera/launcher/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ func SetDataDir(datadir string) {

func measureDbDir(name, datadir string) {
var (
dbSize atomic.Int64
gauge metrics.Gauge
dbSize int64
gauge metrics.Gauge
rescan = (len(datadir) > 0 && datadir != "inmemory")
)
for {
time.Sleep(time.Second)

if rescan {
size := sizeOfDir(datadir)
dbSize.Store(size)
atomic.StoreInt64(&dbSize, size)
}

if gauge == nil {
gauge = metrics.NewRegisteredFunctionalGauge(name, nil, func() int64 {
return dbSize.Load()
return atomic.LoadInt64(&dbSize)
})
}

Expand Down

0 comments on commit e585097

Please sign in to comment.