-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* handling null case for user type. * adding fallback incase userType is null * handling user type null and adding existing guest user count to messages * adding UTs * Fix warnings * moving to extension * localized strings * adding comment for usage of GetUserType * handle 502 status code from graph. * handle 502 bad gateway graph response Co-authored-by: Priyank Saxena <priyank.saxena@microsoft.com>
- Loading branch information
Showing
38 changed files
with
552 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// <copyright file="PollyPolicy.cs" company="Microsoft"> | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// </copyright> | ||
|
||
namespace Microsoft.Teams.Apps.CompanyCommunicator.Common.Policies | ||
{ | ||
using System; | ||
using System.Net; | ||
using Microsoft.Graph; | ||
using Polly; | ||
using Polly.Contrib.WaitAndRetry; | ||
using Polly.Retry; | ||
|
||
/// <summary> | ||
/// Polly policies. | ||
/// </summary> | ||
public class PollyPolicy | ||
{ | ||
/// <summary> | ||
/// Get the graph retry policy. | ||
/// </summary> | ||
/// <param name="maxAttempts">the number of max attempts.</param> | ||
/// <returns>A retry policy that can be applied to async delegates.</returns> | ||
public static AsyncRetryPolicy GetGraphRetryPolicy(int maxAttempts) | ||
{ | ||
var delay = Backoff.DecorrelatedJitterBackoffV2(medianFirstRetryDelay: TimeSpan.FromSeconds(1), retryCount: maxAttempts); | ||
|
||
// Only Handling 502 Bad Gateway Exception | ||
// Other exception such as 429, 503, 504 is handled by default by Graph SDK. | ||
return Policy | ||
.Handle<ServiceException>(e => | ||
e.StatusCode == HttpStatusCode.BadGateway) | ||
.WaitAndRetryAsync(delay); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Source/CompanyCommunicator.Common/Resources/Strings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.