fix(alias): Support forced refresh of file list (#6562)
This commit is contained in:
@ -24,7 +24,8 @@ func list(ctx context.Context, path string, args *ListArgs) ([]model.Obj, error)
|
||||
if storage != nil {
|
||||
_objs, err = op.List(ctx, storage, actualPath, model.ListArgs{
|
||||
ReqPath: path,
|
||||
}, args.Refresh)
|
||||
Refresh: args.Refresh,
|
||||
})
|
||||
if err != nil {
|
||||
if !args.NoLog {
|
||||
log.Errorf("fs/list: %+v", err)
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
type ListArgs struct {
|
||||
ReqPath string
|
||||
S3ShowPlaceholder bool
|
||||
Refresh bool
|
||||
}
|
||||
|
||||
type LinkArgs struct {
|
||||
|
@ -100,14 +100,14 @@ func Key(storage driver.Driver, path string) string {
|
||||
}
|
||||
|
||||
// List files in storage, not contains virtual file
|
||||
func List(ctx context.Context, storage driver.Driver, path string, args model.ListArgs, refresh ...bool) ([]model.Obj, error) {
|
||||
func List(ctx context.Context, storage driver.Driver, path string, args model.ListArgs) ([]model.Obj, error) {
|
||||
if storage.Config().CheckStatus && storage.GetStorage().Status != WORK {
|
||||
return nil, errors.Errorf("storage not init: %s", storage.GetStorage().Status)
|
||||
}
|
||||
path = utils.FixAndCleanPath(path)
|
||||
log.Debugf("op.List %s", path)
|
||||
key := Key(storage, path)
|
||||
if !utils.IsBool(refresh...) {
|
||||
if !args.Refresh {
|
||||
if files, ok := listCache.Get(key); ok {
|
||||
log.Debugf("use cache when list %s", path)
|
||||
return files, nil
|
||||
|
Reference in New Issue
Block a user