mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 00:13:49 +01:00
test memory: read metadata if -M flag is specified
This commit is contained in:
parent
ec3cee89d3
commit
43506f8086
@ -29,6 +29,7 @@ var commandDefinition = &cobra.Command{
|
||||
cmd.Run(false, false, command, func() error {
|
||||
ctx := context.Background()
|
||||
ci := fs.GetConfig(context.Background())
|
||||
metadata := ci.Metadata && fsrc.Features().ReadMetadata
|
||||
objects, _, _, err := operations.Count(ctx, fsrc)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -39,6 +40,13 @@ var commandDefinition = &cobra.Command{
|
||||
runtime.ReadMemStats(&before)
|
||||
var mu sync.Mutex
|
||||
err = operations.ListFn(ctx, fsrc, func(o fs.Object) {
|
||||
// Read the metadata so it gets cached in the object
|
||||
if metadata {
|
||||
_, err := fs.GetMetadata(ctx, o)
|
||||
if err != nil {
|
||||
fs.Errorf(o, "Failed to read metadata: %v", err)
|
||||
}
|
||||
}
|
||||
mu.Lock()
|
||||
objs = append(objs, o)
|
||||
mu.Unlock()
|
||||
|
Loading…
Reference in New Issue
Block a user