Skip to content

Commit

Permalink
Added more logging when rate limiting is hit
Browse files Browse the repository at this point in the history
  • Loading branch information
hortha committed Dec 19, 2024
1 parent ac1b899 commit 841f382
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ private async Task<IReadOnlyDictionary<Guid, AuditDetailCollection>> GetAuditRec
}
catch (FaultException fex) when (fex.IsCrmRateLimitException(out var retryAfter))
{
_logger.LogWarning("Hit CRM service limits; Fault exception");
await Task.Delay(retryAfter, cancellationToken);
continue;
}
Expand All @@ -842,11 +843,13 @@ private async Task<IReadOnlyDictionary<Guid, AuditDetailCollection>> GetAuditRec

if (firstFault.IsCrmRateLimitFault(out var retryAfter))
{
_logger.LogWarning("Hit CRM service limits; CRM rate limit fault");
await Task.Delay(retryAfter, cancellationToken);
continue;
}
else if (firstFault.Message.Contains("The HTTP status code of the response was not expected (429)"))
{
_logger.LogWarning("Hit CRM service limits; 429 too many requests");
await Task.Delay(TimeSpan.FromMinutes(2), cancellationToken);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"MinimumLevel": {
"Default": "Error",
"Override": {
"TeachingRecordSystem.Worker": "Warning"
"TeachingRecordSystem.Worker": "Warning",
"TeachingRecordSystem.Core.Services.TrsDataSync": "Warning",
"TeachingRecordSystem.Core.Jobs": "Warning"
}
}
},
Expand Down

0 comments on commit 841f382

Please sign in to comment.