fix: database is locked
when using sqlite
This commit is contained in:
parent
ff22f5c8b9
commit
f8b7e086ba
3 changed files with 9 additions and 8 deletions
2
assets
2
assets
|
@ -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…
Add table
Reference in a new issue