From 38a7876c2d5dca1a8ec4dce26e7558f084fc7f54 Mon Sep 17 00:00:00 2001 From: Varun Puranik Date: Wed, 17 Aug 2022 22:10:35 -0700 Subject: [PATCH 1/3] EH change to not report connected clients --- .../EdgeHubConnection.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs b/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs index 2a9b839507d..a0e66412658 100644 --- a/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs +++ b/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs @@ -88,7 +88,8 @@ internal async void DeviceDisconnected(object sender, IIdentity device) { try { - await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Disconnected); + //await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Disconnected); + await Task.CompletedTask; } catch (Exception ex) { @@ -100,7 +101,8 @@ internal async void DeviceConnected(object sender, IIdentity device) { try { - await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Connected); + //await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Connected); + await Task.CompletedTask; } catch (Exception ex) { From 6243b4168468e181f76569d02695d507d3cef444 Mon Sep 17 00:00:00 2001 From: Varun Puranik Date: Wed, 17 Aug 2022 22:38:55 -0700 Subject: [PATCH 2/3] Fix spacing --- .../EdgeHubConnection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs b/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs index a0e66412658..103528a1dc8 100644 --- a/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs +++ b/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/EdgeHubConnection.cs @@ -88,7 +88,7 @@ internal async void DeviceDisconnected(object sender, IIdentity device) { try { - //await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Disconnected); + // await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Disconnected); await Task.CompletedTask; } catch (Exception ex) @@ -101,7 +101,7 @@ internal async void DeviceConnected(object sender, IIdentity device) { try { - //await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Connected); + // await this.UpdateDeviceConnectionStatus(device, ConnectionStatus.Connected); await Task.CompletedTask; } catch (Exception ex) From b94ae978a78f81461a3ad007845a8ad0a70f4c3b Mon Sep 17 00:00:00 2001 From: Varun Puranik Date: Thu, 8 Sep 2022 22:39:47 -0700 Subject: [PATCH 3/3] Change event logging --- .../DeviceScopeIdentitiesCache.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs b/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs index 15dc6b38c77..afb15f72ea9 100644 --- a/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs +++ b/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs @@ -184,7 +184,10 @@ await serviceIdentity } else { - Events.SkipRefreshServiceIdentity(refreshTarget, this.identitiesLastRefreshTime[refreshTarget], this.refreshDelay); + Events.SkipRefreshServiceIdentity( + refreshTarget, + this.identitiesLastRefreshTime.TryGetValue(refreshTarget, out DateTime lastRefreshTime) ? lastRefreshTime : DateTime.UtcNow, + this.refreshDelay); } } catch (DeviceInvalidStateException ex)