diff --git a/core/loadpoint.go b/core/loadpoint.go index 6030a474a4..a50daccc79 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -174,7 +174,7 @@ type Loadpoint struct { progress *Progress // Step-wise progress indicator // session log - db session.Database + db *session.DB session *session.Session tasks *util.Queue[Task] // tasks to be executed diff --git a/core/session/db.go b/core/session/db.go index bb1ec43bde..a334425547 100644 --- a/core/session/db.go +++ b/core/session/db.go @@ -12,11 +12,6 @@ type DB struct { name string } -type Database interface { - New(startEnergy float64) *Session - Persist(session interface{}) -} - // NewStore creates a session store func NewStore(name string, db *gorm.DB) (*DB, error) { err := db.AutoMigrate(new(Session)) diff --git a/core/site.go b/core/site.go index a335b7d28a..68bc4605ca 100644 --- a/core/site.go +++ b/core/site.go @@ -139,13 +139,11 @@ func NewSiteFromConfig( if db.Instance != nil { var err error - var sessionDb *session.DB - if sessionDb, err = session.NewStore(lp.Title(), db.Instance); err != nil { + if lp.db, err = session.NewStore(lp.Title(), db.Instance); err != nil { return nil, err } - lp.db = sessionDb //Fix any dangling history - if err = sessionDb.ClosePendingSessionsInHistory(lp.chargeMeterTotal()); err != nil { + if err = lp.db.ClosePendingSessionsInHistory(lp.chargeMeterTotal()); err != nil { return nil, err }