优化代码

This commit is contained in:
GoEdgeLab
2022-09-07 14:54:36 +08:00
parent 4074648bf1
commit c3bbcc15e7
2 changed files with 9 additions and 4 deletions

View File

@@ -432,6 +432,10 @@ func (this *FileListDB) Close() error {
_ = this.listOlderItemsStmt.Close() _ = this.listOlderItemsStmt.Close()
} }
if this.writeBatch != nil {
this.writeBatch.Close()
}
var errStrings []string var errStrings []string
if this.readDB != nil { if this.readDB != nil {
@@ -448,10 +452,6 @@ func (this *FileListDB) Close() error {
} }
} }
if this.writeBatch != nil {
this.writeBatch.Close()
}
if len(errStrings) == 0 { if len(errStrings) == 0 {
return nil return nil
} }

View File

@@ -64,6 +64,11 @@ For:
for { for {
// closed // closed
if this.isClosed { if this.isClosed {
if lastTx != nil {
_ = lastTx.Commit()
lastTx = nil
}
return return
} }