b2: fix inconsistent listings and rclone check

This was caused by re-using a variable for the results of a JSON
unmarshal and the unmarshaller picking up existing entries.

See https://forum.rclone.org/t/check-command-gives-unreliable-results/
This commit is contained in:
Nick Craig-Wood 2017-03-01 07:57:10 +00:00
parent 0ce34be41d
commit 1d42a343d2

View file

@ -467,7 +467,6 @@ func (f *Fs) list(dir string, level int, prefix string, limit int, hidden bool,
if prefix != "" { if prefix != "" {
request.StartFileName = prefix request.StartFileName = prefix
} }
var response api.ListFileNamesResponse
opts := rest.Opts{ opts := rest.Opts{
Method: "POST", Method: "POST",
Path: "/b2_list_file_names", Path: "/b2_list_file_names",
@ -476,6 +475,7 @@ func (f *Fs) list(dir string, level int, prefix string, limit int, hidden bool,
opts.Path = "/b2_list_file_versions" opts.Path = "/b2_list_file_versions"
} }
for { for {
var response api.ListFileNamesResponse
err := f.pacer.Call(func() (bool, error) { err := f.pacer.Call(func() (bool, error) {
resp, err := f.srv.CallJSON(&opts, &request, &response) resp, err := f.srv.CallJSON(&opts, &request, &response)
return f.shouldRetry(resp, err) return f.shouldRetry(resp, err)