mirror of
https://github.com/rclone/rclone.git
synced 2025-08-15 08:12:45 +02:00
accounting: fix global error acounting
fs.CountError is called when an error is encountered. The method was calling GlobalStats().Error(err) which incremented the error at the global stats level. This led to calls to core/stats with group= filter returning an error count of 0 even if errors actually occured. This change requires the context to be provided when calling fs.CountError. Doing so, we can retrieve the correct StatsInfo to increment the errors from. Fixes #5865
This commit is contained in:
committed by
Nick Craig-Wood
parent
c053429b9c
commit
8a6fc8535d
@ -946,7 +946,7 @@ func TestSyncIgnoreErrors(t *testing.T) {
|
||||
|
||||
accounting.GlobalStats().ResetCounters()
|
||||
ctx = predictDstFromLogger(ctx)
|
||||
_ = fs.CountError(errors.New("boom"))
|
||||
_ = fs.CountError(ctx, errors.New("boom"))
|
||||
assert.NoError(t, Sync(ctx, r.Fremote, r.Flocal, false))
|
||||
testLoggerVsLsf(ctx, r.Fremote, operations.GetLoggerOpt(ctx).JSON, t)
|
||||
|
||||
@ -1267,7 +1267,7 @@ func TestSyncAfterRemovingAFileAndAddingAFileSubDirWithErrors(t *testing.T) {
|
||||
|
||||
ctx = predictDstFromLogger(ctx)
|
||||
accounting.GlobalStats().ResetCounters()
|
||||
_ = fs.CountError(errors.New("boom"))
|
||||
_ = fs.CountError(ctx, errors.New("boom"))
|
||||
err := Sync(ctx, r.Fremote, r.Flocal, false)
|
||||
assert.Equal(t, fs.ErrorNotDeleting, err)
|
||||
testLoggerVsLsf(ctx, r.Fremote, operations.GetLoggerOpt(ctx).JSON, t)
|
||||
|
Reference in New Issue
Block a user