chore: add refresh arg in list func
This commit is contained in:
@ -17,6 +17,7 @@ var notify = NewNotify()
|
||||
var client rpc.Client
|
||||
|
||||
func InitClient(timeout int) (string, error) {
|
||||
client = nil
|
||||
uri := setting.GetByKey(conf.Aria2Uri)
|
||||
secret := setting.GetByKey(conf.Aria2Secret)
|
||||
return InitAria2Client(uri, secret, timeout)
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
// So, the purpose of this package is to convert virtual path to actual path
|
||||
// then pass the actual path to the operations package
|
||||
|
||||
func List(ctx context.Context, path string) ([]model.Obj, error) {
|
||||
res, err := list(ctx, path)
|
||||
func List(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error) {
|
||||
res, err := list(ctx, path, refresh...)
|
||||
if err != nil {
|
||||
log.Errorf("failed list %s: %+v", path, err)
|
||||
return nil, err
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// List files
|
||||
func list(ctx context.Context, path string) ([]model.Obj, error) {
|
||||
func list(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error) {
|
||||
meta := ctx.Value("meta").(*model.Meta)
|
||||
user := ctx.Value("user").(*model.User)
|
||||
storage, actualPath, err := operations.GetStorageAndActualPath(path)
|
||||
@ -26,7 +26,7 @@ func list(ctx context.Context, path string) ([]model.Obj, error) {
|
||||
}
|
||||
objs, err := operations.List(ctx, storage, actualPath, model.ListArgs{
|
||||
ReqPath: path,
|
||||
})
|
||||
}, refresh...)
|
||||
if err != nil {
|
||||
log.Errorf("%+v", err)
|
||||
if len(virtualFiles) != 0 {
|
||||
|
Reference in New Issue
Block a user