aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-02-19 22:12:38 +0200
committerTulir Asokan <tulir@maunium.net>2020-02-19 22:12:38 +0200
commit257eaa077a87d80163fa34217afbda3e97b988ee (patch)
tree0239230d8089b09847cf7b7dba45a1833b524855
parent8e33beeee7bb288074d065aff8a53a12ed7c2d6e (diff)
Only initialize history manager if not initialized
-rw-r--r--matrix/matrix.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index c33a749..c89f884 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -34,6 +34,8 @@ import (
dbg "runtime/debug"
"time"
+ "github.com/pkg/errors"
+
"maunium.net/go/gomuks/lib/open"
"maunium.net/go/gomuks/matrix/event"
"maunium.net/go/mautrix"
@@ -108,9 +110,11 @@ func (c *Container) InitClient() error {
}
c.client.Logger = mxLogger{}
- c.history, err = NewHistoryManager(c.config.HistoryPath)
- if err != nil {
- return err
+ if c.history == nil {
+ c.history, err = NewHistoryManager(c.config.HistoryPath)
+ if err != nil {
+ return errors.Wrap(err, "failed to initialize history")
+ }
}
allowInsecure := len(os.Getenv("GOMUKS_ALLOW_INSECURE_CONNECTIONS")) > 0