From 4774a2cc4037b76af7784aa6470d63aa579457a3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 28 Jan 2016 22:45:29 -0500 Subject: [PATCH] update network cache --- .../Networking/BaseNetworkManager.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs index 527a5fb3e..ff11c889a 100644 --- a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs +++ b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs @@ -20,14 +20,6 @@ namespace MediaBrowser.Common.Implementations.Networking Logger = logger; } - private void ClearCacheTimerCallback(object state) - { - lock (_localIpAddressSyncLock) - { - _localIpAddresses = null; - } - } - private volatile List _localIpAddresses; private readonly object _localIpAddressSyncLock = new object(); @@ -37,13 +29,14 @@ namespace MediaBrowser.Common.Implementations.Networking /// IPAddress. public IEnumerable GetLocalIpAddresses() { - var forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= 1; + const int cacheMinutes = 3; + var forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= cacheMinutes; if (_localIpAddresses == null || forceRefresh) { lock (_localIpAddressSyncLock) { - forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= 1; + forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= cacheMinutes; if (_localIpAddresses == null || forceRefresh) {