Execute retry logic in Send() method even if exception is not of type WebException #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
We had an issue in production yesterday that caused our application to go offline on a couple of web servers for about a 1.5 minutes. During our investigation we found the following call stack:
Apr 24 14:59:12: Unhandled Exception: System.OperationCanceledException: The operation was canceled.
Apr 24 14:59:12: at System.Net.HttpWebRequest.GetResponse()
Apr 24 14:59:12: at log4net.loggly.LogglyClient.Send(ILogglyAppenderConfig config, String message)
Apr 24 14:59:12: at log4net.loggly.LogglyAsyncHandler.SendLogs()
Apr 24 14:59:12: at System.Threading.Thread.ThreadMain_ThreadStart()
Apr 24 14:59:12: at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
It looks like the LogglyClient received an exception of type System.OperationCanceledException which is not handled in the Send() method so it crashed our process. This PR accounts for generic exceptions and executes the same retry logic. Applicable unit test has also been added.