fix #1860 : Only repeat the WAL warning once (#1863)

* fix #1860
This commit is contained in:
Thibault "bui" Koechlin 2022-11-07 16:36:39 +01:00 committed by GitHub
parent 895691dad1
commit 3b4da7e637
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -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
}

View file

@ -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"