Skip to content

Commit

Permalink
APIGOV-19786 - wait for data dir to exist before starting metric coll…
Browse files Browse the repository at this point in the history
…ector
  • Loading branch information
jcollins-axway committed Aug 10, 2021
1 parent 3385b2c commit 921299a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/transaction/metric/metricscollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package metric
import (
"flag"
"fmt"
"os"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -64,7 +65,12 @@ type usageEventQueueItem struct {

func init() {
go func() {
for traceability.GetDataDirPath() == "" {
// Wait for the datadir to be set and exist
dataDir := ""
_, err := os.Stat(dataDir)
for dataDir == "" || os.IsNotExist(err) {
dataDir = traceability.GetDataDirPath()
_, err = os.Stat(dataDir)
}
GetMetricCollector()
}()
Expand Down

0 comments on commit 921299a

Please sign in to comment.