diff --git a/src/NuGet.Services.Revalidate/Services/RevalidationJobStateService.cs b/src/NuGet.Services.Revalidate/Services/RevalidationJobStateService.cs index 2ace054da..961e8994b 100644 --- a/src/NuGet.Services.Revalidate/Services/RevalidationJobStateService.cs +++ b/src/NuGet.Services.Revalidate/Services/RevalidationJobStateService.cs @@ -104,7 +104,8 @@ await _state.MaybeUpdateStateAsync(state => return false; } - var nextRate = Math.Min(_config.MaxPackageEventRate, state.DesiredPackageEventRate + 1); + var nextRate = state.DesiredPackageEventRate + _config.Queue.MaxBatchSize; + nextRate = Math.Min(_config.MaxPackageEventRate, nextRate); _logger.LogInformation( "Increasing desired package event rate to {ToRate} from {FromRate}", diff --git a/tests/NuGet.Services.Revalidate.Tests/Services/RevalidationJobStateServiceFacts.cs b/tests/NuGet.Services.Revalidate.Tests/Services/RevalidationJobStateServiceFacts.cs index 7403364bf..7c7aa9f06 100644 --- a/tests/NuGet.Services.Revalidate.Tests/Services/RevalidationJobStateServiceFacts.cs +++ b/tests/NuGet.Services.Revalidate.Tests/Services/RevalidationJobStateServiceFacts.cs @@ -183,7 +183,7 @@ public async Task IncreasesDesiredPackageEventRateValue() await _target.IncreaseDesiredPackageEventRateAsync(); // Assert - Assert.Equal(124, state.DesiredPackageEventRate); + Assert.Equal(143, state.DesiredPackageEventRate); Assert.True(result); _state.Verify(s => s.MaybeUpdateStateAsync(It.IsAny>()), Times.Once); @@ -261,6 +261,11 @@ public FactsBase() { MinPackageEventRate = 100, MaxPackageEventRate = 500, + + Queue = new RevalidationQueueConfiguration + { + MaxBatchSize = 20 + } }; _target = new RevalidationJobStateService(