Skip to content

Commit

Permalink
move time.Now outside critical section
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Oct 11, 2023
1 parent 89540b1 commit 3573250
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion trie/triedb/hashdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,9 @@ func (db *Database) Cap(limit common.StorageSize) error {
// outside code doesn't see an inconsistent state (referenced data removed from
// memory cache during commit but not yet in persistent storage). This is ensured
// by only uncaching existing data when the database write finalizes.
start := time.Now()
db.lock.RLock()
nodes, storage, start := len(db.dirties), db.dirtiesSize, time.Now()
nodes, storage := len(db.dirties), db.dirtiesSize
batch := db.diskdb.NewBatch()

// db.dirtiesSize only contains the useful data in the cache, but when reporting
Expand Down

0 comments on commit 3573250

Please sign in to comment.