From 7f0ee525a2e54429418fef79c1095808f9bc7ded Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 19 Sep 2020 10:05:44 -0500 Subject: [PATCH] =?UTF-8?q?feat(archival):=20=E2=9C=A8=E2=9A=A1=20equally?= =?UTF-8?q?=20space=20archival=20jobs=20throughout=20the=20day=20to=20dist?= =?UTF-8?q?ribute=20resources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/EnqueueArchiveAllLists.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/Archival/FilterLists.Archival.Application/Commands/EnqueueArchiveAllLists.cs b/services/Archival/FilterLists.Archival.Application/Commands/EnqueueArchiveAllLists.cs index 7bea02033..a6134a21d 100644 --- a/services/Archival/FilterLists.Archival.Application/Commands/EnqueueArchiveAllLists.cs +++ b/services/Archival/FilterLists.Archival.Application/Commands/EnqueueArchiveAllLists.cs @@ -29,15 +29,18 @@ public async Task Handle(Command request, CancellationToken cancellationTo var lists = (await _directory.GetListsAsync(cancellationToken)).OrderBy(_ => r.Next()).ToList(); int numToArchive; + TimeSpan spacing; #if DEBUG numToArchive = 25; + spacing = TimeSpan.FromSeconds(2.5); #else numToArchive = lists.Count; + spacing = TimeSpan.FromSeconds((double)86400 / lists.Count); #endif for (var i = 0; i < numToArchive; i++) { - new ArchiveList.Command(lists[i].Id).EnqueueBackgroundJob(); + new ArchiveList.Command(lists[i].Id).ScheduleBackgroundJob(i * spacing); } return Unit.Value;