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) 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..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,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) {