aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-07 14:22:31 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-07 14:22:31 -0400
commita90908f0f72cfc27528e4df6516f9cca8897c818 (patch)
tree2db3eb3220d5160dc033dbddb89ee63c3d97f147
parenta0df73b21dfdfde894760cf70b81dfd01b1c70f8 (diff)
update service text in wizard
-rw-r--r--MediaBrowser.Common.Implementations/Updates/InstallationManager.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs36
2 files changed, 25 insertions, 13 deletions
diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs
index 60db90476..222f41e0d 100644
--- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs
+++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs
@@ -168,7 +168,7 @@ namespace MediaBrowser.Common.Implementations.Updates
{
// Let dev users get results more often for testing purposes
var cacheLength = _config.CommonConfiguration.SystemUpdateLevel == PackageVersionClass.Dev
- ? TimeSpan.FromHours(1)
+ ? TimeSpan.FromMinutes(15)
: TimeSpan.FromHours(12);
if ((DateTime.UtcNow - _lastPackageListResult.Item2) < cacheLength)
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index 6bb6edf7a..d3b6bc59f 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
@@ -44,11 +44,13 @@ namespace MediaBrowser.Server.Implementations.Session
/// <value>The configuration manager.</value>
private readonly IServerConfigurationManager _configurationManager;
+ private object _sessionLock = new object();
+
/// <summary>
/// The _active connections
/// </summary>
- private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections =
- new ConcurrentDictionary<string, SessionInfo>(StringComparer.OrdinalIgnoreCase);
+ private readonly Dictionary<string, SessionInfo> _activeConnections =
+ new Dictionary<string, SessionInfo>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Occurs when [playback start].
@@ -84,7 +86,7 @@ namespace MediaBrowser.Server.Implementations.Session
/// <value>All connections.</value>
public IEnumerable<SessionInfo> Sessions
{
- get { return _activeConnections.Values.OrderByDescending(c => c.LastActivityDate).ToList(); }
+ get { return _activeConnections.Values.ToList().OrderByDescending(c => c.LastActivityDate); }
}
/// <summary>
@@ -193,18 +195,28 @@ namespace MediaBrowser.Server.Implementations.Session
{
var key = clientType + deviceId + appVersion;
- var connection = _activeConnections.GetOrAdd(key, keyName => new SessionInfo
+ lock (_sessionLock)
{
- Client = clientType,
- DeviceId = deviceId,
- ApplicationVersion = appVersion,
- Id = Guid.NewGuid()
- });
+ SessionInfo connection;
- connection.DeviceName = deviceName;
- connection.User = user;
+ if (!_activeConnections.TryGetValue(key, out connection))
+ {
+ connection = new SessionInfo
+ {
+ Client = clientType,
+ DeviceId = deviceId,
+ ApplicationVersion = appVersion,
+ Id = Guid.NewGuid()
+ };
+
+ _activeConnections[key] = connection;
+ }
- return connection;
+ connection.DeviceName = deviceName;
+ connection.User = user;
+
+ return connection;
+ }
}
/// <summary>