mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
matrix: add log for matrix crypto store init
deleting the crypto DB resulted in InitMatrixCrypto taking ages, added a Initing/Inited log pair around the function so it's obvious this is the culprit if any one else faces the same thing.
This commit is contained in:
@@ -64,12 +64,14 @@ const (
|
|||||||
TimedOut = "timed out"
|
TimedOut = "timed out"
|
||||||
FailedGenericWithCode = "failed (code %d)"
|
FailedGenericWithCode = "failed (code %d)"
|
||||||
|
|
||||||
InitDiscord = "Initialized Discord daemon"
|
InitDiscord = "Initialized Discord daemon"
|
||||||
FailedInitDiscord = "Failed to initialize Discord daemon: %v"
|
FailedInitDiscord = "Failed to initialize Discord daemon: %v"
|
||||||
InitTelegram = "Initialized Telegram daemon"
|
InitTelegram = "Initialized Telegram daemon"
|
||||||
FailedInitTelegram = "Failed to initialize Telegram daemon: %v"
|
FailedInitTelegram = "Failed to initialize Telegram daemon: %v"
|
||||||
InitMatrix = "Initialized Matrix daemon"
|
InitMatrix = "Initialized Matrix daemon"
|
||||||
FailedInitMatrix = "Failed to initialize Matrix daemon: %v"
|
FailedInitMatrix = "Failed to initialize Matrix daemon: %v"
|
||||||
|
InitingMatrixCrypto = "Initializing Matrix encryption store"
|
||||||
|
InitMatrixCrypto = "Initialized Matrix encryption store"
|
||||||
|
|
||||||
InitRouter = "Initializing router"
|
InitRouter = "Initializing router"
|
||||||
LoadRoutes = "Loading Routes"
|
LoadRoutes = "Loading Routes"
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ func newMatrixDaemon(app *appContext) (d *MatrixDaemon, err error) {
|
|||||||
d.languages[id.RoomID(user.RoomID)] = user.Lang
|
d.languages[id.RoomID(user.RoomID)] = user.Lang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = InitMatrixCrypto(d)
|
err = InitMatrixCrypto(d, app.info)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/hrfee/jfa-go/logger"
|
||||||
|
lm "github.com/hrfee/jfa-go/logmessages"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"maunium.net/go/mautrix/crypto/cryptohelper"
|
"maunium.net/go/mautrix/crypto/cryptohelper"
|
||||||
"maunium.net/go/mautrix/event"
|
"maunium.net/go/mautrix/event"
|
||||||
@@ -22,7 +24,8 @@ func BuildTagsE2EE() {
|
|||||||
|
|
||||||
func MatrixE2EE() bool { return true }
|
func MatrixE2EE() bool { return true }
|
||||||
|
|
||||||
func InitMatrixCrypto(d *MatrixDaemon) error {
|
func InitMatrixCrypto(d *MatrixDaemon, logger *logger.Logger) error {
|
||||||
|
logger.Printf(lm.InitingMatrixCrypto)
|
||||||
d.Encryption = d.app.config.Section("matrix").Key("encryption").MustBool(false)
|
d.Encryption = d.app.config.Section("matrix").Key("encryption").MustBool(false)
|
||||||
if !d.Encryption {
|
if !d.Encryption {
|
||||||
// return fmt.Errorf("encryption disabled")
|
// return fmt.Errorf("encryption disabled")
|
||||||
@@ -45,6 +48,7 @@ func InitMatrixCrypto(d *MatrixDaemon) error {
|
|||||||
d.bot.Crypto = d.crypto.helper
|
d.bot.Crypto = d.crypto.helper
|
||||||
|
|
||||||
d.Encryption = true
|
d.Encryption = true
|
||||||
|
logger.Printf(lm.InitMatrixCrypto)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "maunium.net/go/mautrix/id"
|
import (
|
||||||
|
"github.com/hrfee/jfa-go/logger"
|
||||||
|
"maunium.net/go/mautrix/id"
|
||||||
|
)
|
||||||
|
|
||||||
type Crypto struct{}
|
type Crypto struct{}
|
||||||
|
|
||||||
@@ -11,7 +14,7 @@ func BuildTagsE2EE() {}
|
|||||||
|
|
||||||
func MatrixE2EE() bool { return false }
|
func MatrixE2EE() bool { return false }
|
||||||
|
|
||||||
func InitMatrixCrypto(d *MatrixDaemon) (err error) {
|
func InitMatrixCrypto(d *MatrixDaemon, logger *logger.Logger) (err error) {
|
||||||
d.Encryption = false
|
d.Encryption = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user