From 3b4da7e6372de1866e4a23cc00dd007a7437ff40 Mon Sep 17 00:00:00 2001 From: "Thibault \"bui\" Koechlin" Date: Mon, 7 Nov 2022 16:36:39 +0100 Subject: [PATCH] fix #1860 : Only repeat the WAL warning once (#1863) * fix #1860 --- pkg/csconfig/database.go | 8 ++++++++ pkg/database/database.go | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/csconfig/database.go b/pkg/csconfig/database.go index aa3e3ce97..85b75d737 100644 --- a/pkg/csconfig/database.go +++ b/pkg/csconfig/database.go @@ -57,5 +57,13 @@ func (c *Config) LoadDBConfig() error { if c.DbConfig.MaxOpenConns == nil { c.DbConfig.MaxOpenConns = types.IntPtr(DEFAULT_MAX_OPEN_CONNS) } + + if c.DbConfig.Type == "sqlite" { + if c.DbConfig.UseWal == nil { + log.Warning("You are using sqlite without WAL, this can have an impact of performance. If you do not store the database in a network share, set db_config.use_wal to true. Set explicitly to false to disable this warning.") + } + + } + return nil } diff --git a/pkg/database/database.go b/pkg/database/database.go index af2d2f38b..71ce076c0 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -77,9 +77,6 @@ func NewClient(config *csconfig.DatabaseCfg) (*Client, error) { if err := setFilePerm(config.DbPath, 0600); err != nil { return &Client{}, fmt.Errorf("unable to set perms on %s: %v", config.DbPath, err) } - if config.UseWal == nil { - entLogger.Warn("you are using sqlite without WAL, this can have an impact of performance. If you do not store the database in a network share, set db_config.use_wal to true. Set explicitly to false to disable this warning.") - } var sqliteConnectionStringParameters string if config.UseWal != nil && *config.UseWal { sqliteConnectionStringParameters = "_busy_timeout=100000&_fk=1&_journal_mode=WAL"