Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 42ec3bc

Browse files
committed
Address comment
1 parent c88ff86 commit 42ec3bc

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

ss/pebbledb/db.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ func New(dataDir string, config config.StateStoreConfig) (*Database, error) {
172172
}
173173

174174
func (db *Database) Close() error {
175-
// First, stop accepting new pending changes and drain the worker
176-
close(db.pendingChanges)
177-
// Wait for the async writes to finish
178-
db.asyncWriteWG.Wait()
179-
// Now close the WAL stream
180175
if db.streamHandler != nil {
176+
// First, stop accepting new pending changes and drain the worker
177+
close(db.pendingChanges)
178+
// Wait for the async writes to finish
179+
db.asyncWriteWG.Wait()
180+
// Now close the WAL stream
181181
_ = db.streamHandler.Close()
182182
db.streamHandler = nil
183183
}

ss/rocksdb/db.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,13 @@ func (db *Database) WriteBlockRangeHash(storeKey string, beginBlockRange, endBlo
492492
}
493493

494494
func (db *Database) Close() error {
495-
// Close the pending changes channel to signal the background goroutine to stop
496-
close(db.pendingChanges)
497-
// Wait for the async writes to finish processing all buffered items
498-
db.asyncWriteWG.Wait()
499495
if db.streamHandler != nil {
496+
// Close the pending changes channel to signal the background goroutine to stop
497+
close(db.pendingChanges)
498+
// Wait for the async writes to finish processing all buffered items
499+
db.asyncWriteWG.Wait()
500500
// Close the changelog stream first
501-
db.streamHandler.Close()
501+
_ = db.streamHandler.Close()
502502
// Only set to nil after background goroutine has finished
503503
db.streamHandler = nil
504504
}

0 commit comments

Comments
 (0)