fix: `database is locked` when using sqlite

pull/1239/head
HFO4 3 years ago
parent ff22f5c8b9
commit f8b7e086ba

@ -1 +1 @@
Subproject commit f2e11958738434c5a14547f21b6e78d7f3aec6fe
Subproject commit 032ce5ba95803fa5667538c0254f7812acd34449

@ -73,10 +73,13 @@ func Init() {
}
//设置连接池
//空闲
db.DB().SetMaxIdleConns(50)
//打开
db.DB().SetMaxOpenConns(100)
if conf.DatabaseConfig.Type == "sqlite" || conf.DatabaseConfig.Type == "sqlite3" || conf.DatabaseConfig.Type == "UNSET" {
db.DB().SetMaxOpenConns(1)
} else {
db.DB().SetMaxOpenConns(100)
}
//超时
db.DB().SetConnMaxLifetime(time.Second * 30)

@ -424,11 +424,9 @@ func (fs *FileSystem) CreateDirectory(ctx context.Context, fullPath string) (*mo
_, err := newFolder.Create()
if err != nil {
if _, ok := ctx.Value(fsctx.IgnoreDirectoryConflictCtx).(bool); !ok {
return nil, fmt.Errorf("failed to create folder: %w", err)
}
return nil, fmt.Errorf("failed to create folder: %w", err)
}
return &newFolder, nil
}

Loading…
Cancel
Save