Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
firelizzard18 committed May 10, 2024
1 parent 696b0f9 commit 6f238bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/accumulated/run/core_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
func (c *CoreValidatorConfiguration) apply(_ *Instance, cfg *Config) error {
// Set core validator defaults
setDefaultPtr(&c.StorageType, StorageTypeBadger)
setDefaultPtr(&c.EnableSnapshots, false)

// Validate
if c.Listen == nil {
Expand Down Expand Up @@ -116,6 +115,8 @@ type partOpts struct {
}

func (p partOpts) apply(cfg *Config) error {
setDefaultPtr(&p.EnableSnapshots, false)

// Consensus
addService(cfg,
&ConsensusService{
Expand Down
5 changes: 3 additions & 2 deletions pkg/database/keyvalue/leveldb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func (d *Database) Begin(prefix *record.Key, writable bool) keyvalue.ChangeSet {
if d.closing.Load() {
err = errors.Conflict.With("closed")
} else {
d.open.Add(1)
snap, err = d.leveldb.GetSnapshot()
}

Expand All @@ -90,8 +89,10 @@ func (d *Database) Begin(prefix *record.Key, writable bool) keyvalue.ChangeSet {

discard := func() {}
if err == nil {
d.open.Add(1)
var once sync.Once
discard = func() {
defer d.open.Done()
defer once.Do(d.open.Done)
snap.Release()
}
}
Expand Down

0 comments on commit 6f238bb

Please sign in to comment.