Only initialize history manager if not initialized

This commit is contained in:
Tulir Asokan 2020-02-19 22:12:38 +02:00
parent 8e33beeee7
commit 257eaa077a

View File

@ -34,6 +34,8 @@ import (
dbg "runtime/debug" dbg "runtime/debug"
"time" "time"
"github.com/pkg/errors"
"maunium.net/go/gomuks/lib/open" "maunium.net/go/gomuks/lib/open"
"maunium.net/go/gomuks/matrix/event" "maunium.net/go/gomuks/matrix/event"
"maunium.net/go/mautrix" "maunium.net/go/mautrix"
@ -108,9 +110,11 @@ func (c *Container) InitClient() error {
} }
c.client.Logger = mxLogger{} c.client.Logger = mxLogger{}
if c.history == nil {
c.history, err = NewHistoryManager(c.config.HistoryPath) c.history, err = NewHistoryManager(c.config.HistoryPath)
if err != nil { if err != nil {
return err return errors.Wrap(err, "failed to initialize history")
}
} }
allowInsecure := len(os.Getenv("GOMUKS_ALLOW_INSECURE_CONNECTIONS")) > 0 allowInsecure := len(os.Getenv("GOMUKS_ALLOW_INSECURE_CONNECTIONS")) > 0