Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

Commit

Permalink
Speed up the revalidation job by the batch size (#675)
Browse files Browse the repository at this point in the history
Currently, the job will increase its revalidation rate by 1 revalidation per hour each time it enqueues a batch of revalidations. As a result, the job speeds up very slowly. This change makes the job increase its revalidation rate by the batch size. Meaning, the revalidation job will increase its revalidation rate by 64 revalidations per hour if it enqueues 64 revalidations.
  • Loading branch information
loic-sharma authored Nov 20, 2018
1 parent 5296038 commit 8459db8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Func<RevalidationState, bool>>()), Times.Once);
Expand Down Expand Up @@ -261,6 +261,11 @@ public FactsBase()
{
MinPackageEventRate = 100,
MaxPackageEventRate = 500,

Queue = new RevalidationQueueConfiguration
{
MaxBatchSize = 20
}
};

_target = new RevalidationJobStateService(
Expand Down

0 comments on commit 8459db8

Please sign in to comment.