mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
lit: use db.Store interface instead of raw DB pointer
Give the sessionRpcServer access to the session store via the session.Store interface instead of the raw DB pointer. This will make it possible to swop out the implementation (which is currently bbolt) with something else such as a SQL implementation. We move the responsibility of closing the DB to the main LiT server.
This commit is contained in:
parent
03d03eabfc
commit
29f6db7de6
2 changed files with 8 additions and 5 deletions
|
|
@ -58,7 +58,7 @@ type sessionRpcServer struct {
|
|||
// sessionRpcServerConfig holds the values used to configure the
|
||||
// sessionRpcServer.
|
||||
type sessionRpcServerConfig struct {
|
||||
db *session.BoltStore
|
||||
db session.Store
|
||||
basicAuth string
|
||||
grpcOptions []grpc.ServerOption
|
||||
registerGrpcServers func(server *grpc.Server)
|
||||
|
|
@ -175,10 +175,6 @@ func (s *sessionRpcServer) start(ctx context.Context) error {
|
|||
func (s *sessionRpcServer) stop() error {
|
||||
var returnErr error
|
||||
s.stopOnce.Do(func() {
|
||||
if err := s.cfg.db.Close(); err != nil {
|
||||
log.Errorf("Error closing session DB: %v", err)
|
||||
returnErr = err
|
||||
}
|
||||
s.sessionServer.Stop()
|
||||
|
||||
close(s.quit)
|
||||
|
|
|
|||
|
|
@ -1457,6 +1457,13 @@ func (g *LightningTerminal) shutdownSubServers() error {
|
|||
}
|
||||
}
|
||||
|
||||
if g.sessionDB != nil {
|
||||
if err := g.sessionDB.Close(); err != nil {
|
||||
log.Errorf("Error closing session DB: %v", err)
|
||||
returnErr = err
|
||||
}
|
||||
}
|
||||
|
||||
if g.lndClient != nil {
|
||||
g.lndClient.Close()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue