fix: database is locked when using sqlite
This commit is contained in:
2
assets
2
assets
Submodule assets updated: f2e1195873...032ce5ba95
@@ -73,10 +73,13 @@ func Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//设置连接池
|
//设置连接池
|
||||||
//空闲
|
|
||||||
db.DB().SetMaxIdleConns(50)
|
db.DB().SetMaxIdleConns(50)
|
||||||
//打开
|
if conf.DatabaseConfig.Type == "sqlite" || conf.DatabaseConfig.Type == "sqlite3" || conf.DatabaseConfig.Type == "UNSET" {
|
||||||
db.DB().SetMaxOpenConns(100)
|
db.DB().SetMaxOpenConns(1)
|
||||||
|
} else {
|
||||||
|
db.DB().SetMaxOpenConns(100)
|
||||||
|
}
|
||||||
|
|
||||||
//超时
|
//超时
|
||||||
db.DB().SetConnMaxLifetime(time.Second * 30)
|
db.DB().SetConnMaxLifetime(time.Second * 30)
|
||||||
|
|
||||||
|
|||||||
@@ -424,11 +424,9 @@ func (fs *FileSystem) CreateDirectory(ctx context.Context, fullPath string) (*mo
|
|||||||
_, err := newFolder.Create()
|
_, err := newFolder.Create()
|
||||||
|
|
||||||
if err != nil {
|
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
|
return &newFolder, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user