accounting: Allow transfers to be canceled with context #3257

This makes all transfers cancelable even if the backend doesn't
support context as all transfers are done using the Accounting
framework.
This commit is contained in:
Nick Craig-Wood 2020-06-04 15:32:17 +01:00
parent 421585dd72
commit 122a47fba6
3 changed files with 27 additions and 6 deletions

View file

@ -1040,8 +1040,6 @@ func TestSyncWithMaxDuration(t *testing.T) {
startTime := time.Now()
err := Sync(context.Background(), r.Fremote, r.Flocal, false)
require.Equal(t, context.DeadlineExceeded, errors.Cause(err))
err = accounting.GlobalStats().GetLastError()
require.NoError(t, err)
elapsed := time.Since(startTime)
maxTransferTime := (time.Duration(len(testFiles)) * 60 * time.Second) / time.Duration(bytesPerSecond)