When a WebHook is added with an invalid Uri (host does not exist etc) by using the noecho feature so that the WebHook uri is not validated, when the WebHookSender sends the message an exception is thrown in AzureWebHookDequeueManager line 281 when waiting for all Tasks to complete. This causes the rest of the code to not be executed. This causes a situation where all messages are resent indefinitely causing duplicate messages to be transmitted.
try
{
Task<HttpResponseMessage> requestTask = _parent._httpClient.SendAsync(request);
requestTasks.Add(requestTask);
}
catch (Exception ex)
{
string msg = string.Format(CultureInfo.CurrentCulture, AzureStorageResources.DequeueManager_SendFailure, request.RequestUri, ex.Message);
Logger.Info(msg);
CloudQueueMessage message = GetMessage(workItem);
if (DiscardMessage(workItem, message))
{
deleteMessages.Add(message);
}
}
}
// Wait for all responses and see which messages should be deleted from the queue based on the response statuses.
HttpResponseMessage[] responses = await Task.WhenAll(requestTasks);
A solution that I have is to remove the Task.WhenAll(requestTasks) and rather to await on the _parent._httpClient.SendAsync(request) to ensure that exceptions while posting are handled in the exception handling block.
Is this the best way of handling the situation? May I submit a pull request for my solution?
When a WebHook is added with an invalid Uri (host does not exist etc) by using the noecho feature so that the WebHook uri is not validated, when the WebHookSender sends the message an exception is thrown in AzureWebHookDequeueManager line 281 when waiting for all Tasks to complete. This causes the rest of the code to not be executed. This causes a situation where all messages are resent indefinitely causing duplicate messages to be transmitted.
A solution that I have is to remove the Task.WhenAll(requestTasks) and rather to await on the _parent._httpClient.SendAsync(request) to ensure that exceptions while posting are handled in the exception handling block.
Is this the best way of handling the situation? May I submit a pull request for my solution?