Skip to content

Commit

Permalink
Print badger4 levels information every minute (debug)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsanjuan committed Nov 12, 2023
1 parent dec8d5a commit 96c09bc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/ipfs/boxo v0.15.0
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ds-badger4 v0.0.0-20231006150127-9137bcc6b981
github.com/ipfs/go-ds-badger4 v0.0.0-20231112124819-05b485a62f58
github.com/ipfs/go-ipfs-delay v0.0.1
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/go-metrics-interface v0.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8
github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk=
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
github.com/ipfs/go-ds-badger v0.0.7/go.mod h1:qt0/fWzZDoPW6jpQeqUjR5kBfhDNB65jd9YlmAvpQBk=
github.com/ipfs/go-ds-badger4 v0.0.0-20231006150127-9137bcc6b981 h1:GOKV62VnjerKwO7mwOyeoArzlaVrDLyoC/YPNtxxGwg=
github.com/ipfs/go-ds-badger4 v0.0.0-20231006150127-9137bcc6b981/go.mod h1:LUU2FbhNdmhAbJmMeoahVRbe4GsduAODSJHWJJh2Vo4=
github.com/ipfs/go-ds-badger4 v0.0.0-20231112124819-05b485a62f58 h1:+bldY2lXKGbuKMc2x2WxNAA9PbAGsb5GF7MkJql2OzY=
github.com/ipfs/go-ds-badger4 v0.0.0-20231112124819-05b485a62f58/go.mod h1:LUU2FbhNdmhAbJmMeoahVRbe4GsduAODSJHWJJh2Vo4=
github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8=
github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM=
github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ=
Expand Down
16 changes: 15 additions & 1 deletion setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,21 @@ func setupDatastore(cfg Config) (datastore.Batching, error) {
Options: badgerOpts,
}

return badger4.NewDatastore(filepath.Join(cfg.DataDir, "badger4"), &opts)
ds, err := badger4.NewDatastore(filepath.Join(cfg.DataDir, "badger4"), &opts)
if err != nil {
return nil, err
}

Check warning on line 413 in setup.go

View check run for this annotation

Codecov / codecov/patch

setup.go#L410-L413

Added lines #L410 - L413 were not covered by tests

// Print level information every minute on debug
go func() {
ticker := time.NewTicker(time.Minute)
defer ticker.Stop()
for {
<-ticker.C
ds.DiskUsage(context.Background())
}

Check warning on line 422 in setup.go

View check run for this annotation

Codecov / codecov/patch

setup.go#L416-L422

Added lines #L416 - L422 were not covered by tests
}()
return ds, nil

Check warning on line 424 in setup.go

View check run for this annotation

Codecov / codecov/patch

setup.go#L424

Added line #L424 was not covered by tests
}

type bundledDHT struct {
Expand Down

0 comments on commit 96c09bc

Please sign in to comment.