Skip to content

Commit

Permalink
Switch to numeric ids in batches
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Sep 27, 2019
1 parent d73cd39 commit 05406ba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Netkan/Processors/QueueHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ private void handleMessages(string url, int howMany, int timeoutMinutes)
{
try
{
// Reset the ids between batches
responseId = 0;
// Might be >10 if Releases>1
var responses = resp.Messages.SelectMany(Inflate).ToList();
for (int i = 0; i < responses.Count; i += howMany)
Expand Down Expand Up @@ -205,9 +207,7 @@ private SendMessageBatchRequestEntry inflationMessage(Metadata ckan, Metadata ne
}
return new SendMessageBatchRequestEntry()
{
Id = ckan == null
? netkan.Identifier
: $"{netkan.Identifier}-{ckan.Version}",
Id = (responseId++).ToString(),
MessageGroupId = "1",
MessageDeduplicationId = Path.GetRandomFileName(),
MessageBody = serializeCkan(ckan),
Expand Down Expand Up @@ -250,6 +250,8 @@ private DeleteMessageBatchRequestEntry Delete(Message msg)

private readonly string inputQueueURL;
private readonly string outputQueueURL;

private int responseId = 0;

private static readonly ILog log = LogManager.GetLogger(typeof(QueueHandler));
}
Expand Down

0 comments on commit 05406ba

Please sign in to comment.