feat: add task work limit

This commit is contained in:
Noah Hsu
2022-06-18 20:38:14 +08:00
parent dd46e99e66
commit d665cce739
6 changed files with 65 additions and 28 deletions

View File

@ -18,7 +18,7 @@ func Put(ctx context.Context, account driver.Driver, parentPath string, file mod
if err != nil {
return errors.WithMessage(err, "failed get account")
}
UploadTaskManager.Add(fmt.Sprintf("upload %s to [%s](%s)", file.GetName(), account.GetAccount().VirtualPath, actualParentPath), func(task *task.Task) error {
UploadTaskManager.Submit(fmt.Sprintf("upload %s to [%s](%s)", file.GetName(), account.GetAccount().VirtualPath, actualParentPath), func(task *task.Task) error {
return operations.Put(task.Ctx, account, actualParentPath, file, nil)
})
return nil