Skip to content

Commit

Permalink
DYN-6350 add request timeout for notification service (#14564)
Browse files Browse the repository at this point in the history
* add request timeout for notification service

* refactor:  implement an auto-property instead of a field for notifications request timeOut

* set notification request timeOut of 10000ms

* refactor: move notifications request timeOut as a constant within Dynamo Configuration

---------

Co-authored-by: reddyashish <[email protected]>
  • Loading branch information
Enzo707 and reddyashish authored Nov 10, 2023
1 parent bc265ce commit 9df196d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/DynamoCore/Configuration/Configurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,5 +429,12 @@ internal static Dictionary<Units, double> SupportedUnits
}

#endregion

#region Notifications Constants
/// <summary>
/// Request timeOut for notifications service
/// </summary>
public const int NotificationsDefaultTimeOut = 10000;
#endregion
}
}
2 changes: 2 additions & 0 deletions src/Notifications/NotificationCenterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Newtonsoft.Json;
using Microsoft.Web.WebView2.Wpf;
using Dynamo.Utilities;
using Dynamo.Configuration;

namespace Dynamo.Notifications
{
Expand Down Expand Up @@ -164,6 +165,7 @@ private void RequestNotifications()
var uri = DynamoUtilities.PathHelper.GetServiceBackendAddress(this, "notificationAddress");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
request.Timeout = Configurations.NotificationsDefaultTimeOut;

using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
Expand Down

0 comments on commit 9df196d

Please sign in to comment.