diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index 49bd5d7f0..5095ee8db 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -210,6 +210,12 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { // Select an appropriate rate limiter for the service. ctx = op.bp.SetRateLimiter(ctx, op.Selectors.PathService(), op.Options) + // For exchange, rate limits are enforced on a mailbox level. Reset the + // rate limiter so that it doesn't accidentally throttle following mailboxes. + // This is a no-op if we are using token bucket limiter since it refreshes + // tokens on a fixed per second basis. + defer graph.ResetLimiter(ctx) + // Check if the protected resource has the service enabled in order for us // to run a backup. enabled, err := op.bp.IsServiceEnabled( @@ -328,12 +334,6 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { logger.Ctx(ctx).Infow("completed backup", "results", op.Results) } - // For exchange, rate limits are enforced on a mailbox level. Reset the - // rate limiter so that it doesn't accidentally throttle following mailboxes. - // This is a no-op if we are using token bucket limiter since it refreshes - // tokens on a fixed per second basis. - graph.ResetLimiter(ctx) - return op.Errors.Failure() }