mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: use sync.pool to obtain new FileSystem instance
This commit is contained in:
@@ -19,6 +19,7 @@ func (service *DirectoryService) ListDirectory(c *gin.Context) serializer.Respon
|
||||
if err != nil {
|
||||
return serializer.Err(serializer.CodePolicyNotAllowed, err.Error(), err)
|
||||
}
|
||||
defer fs.Recycle()
|
||||
|
||||
// 上下文
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -43,9 +44,12 @@ func (service *DirectoryService) CreateDirectory(c *gin.Context) serializer.Resp
|
||||
if err != nil {
|
||||
return serializer.Err(serializer.CodePolicyNotAllowed, err.Error(), err)
|
||||
}
|
||||
defer fs.Recycle()
|
||||
|
||||
// 上下文
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
// 创建目录
|
||||
err = fs.CreateDirectory(ctx, service.Path)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user