diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-06-11 19:45:31 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-06-11 19:45:31 -0400 |
| commit | d0e2027b05e000b64f9cd26c6a10b8ef1f95e481 (patch) | |
| tree | 2cb0124eea3fb0139fa153ff4dfd87541e65bb36 /Emby.Server.Implementations/Session/SessionManager.cs | |
| parent | fc02157b42fe5e4f04681cb82ace9865aaa550cc (diff) | |
(Hopefully) fix concurrency exceptions.
Diffstat (limited to 'Emby.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 900eba18e..b0a4cf83b 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -29,6 +29,7 @@ using MediaBrowser.Model.Library; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Session; using MediaBrowser.Model.SyncPlay; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Episode = MediaBrowser.Controller.Entities.TV.Episode; @@ -285,11 +286,18 @@ namespace Emby.Server.Implementations.Session if (user != null) { var userLastActivityDate = user.LastActivityDate ?? DateTime.MinValue; - user.LastActivityDate = activityDate; if ((activityDate - userLastActivityDate).TotalSeconds > 60) { - _userManager.UpdateUser(user); + try + { + user.LastActivityDate = activityDate; + _userManager.UpdateUser(user); + } + catch (DbUpdateConcurrencyException e) + { + _logger.LogWarning(e, "Error updating user's last activity date."); + } } } |
