优化代码

This commit is contained in:
GoEdgeLab
2024-03-31 10:39:18 +08:00
parent 2a26570c90
commit c060215a53

View File

@@ -4,7 +4,6 @@ package kvstore
import ( import (
"errors" "errors"
"fmt"
"github.com/TeaOSLab/EdgeNode/internal/events" "github.com/TeaOSLab/EdgeNode/internal/events"
"github.com/TeaOSLab/EdgeNode/internal/remotelogs" "github.com/TeaOSLab/EdgeNode/internal/remotelogs"
fsutils "github.com/TeaOSLab/EdgeNode/internal/utils/fs" fsutils "github.com/TeaOSLab/EdgeNode/internal/utils/fs"
@@ -139,10 +138,7 @@ func (this *Store) Open() error {
this.rawDB = rawDB this.rawDB = rawDB
// events // events
events.OnKey(events.EventQuit, fmt.Sprintf("kvstore_%p", this), func() { events.OnClose(func() {
_ = this.Close()
})
events.OnKey(events.EventTerminated, fmt.Sprintf("kvstore_%p", this), func() {
_ = this.Close() _ = this.Close()
}) })