diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-07-16 17:06:20 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-07-16 17:06:20 -0400 |
| commit | 8937e83149276321b786dc18137a96135d94727b (patch) | |
| tree | d474780653d11bb88f7214903f80966daad4a2f0 /MediaBrowser.Server.Implementations | |
| parent | a03b99a229805f0298e7608bf4ec9bcb7e566af0 (diff) | |
do date comparisons in utc
Diffstat (limited to 'MediaBrowser.Server.Implementations')
| -rw-r--r-- | MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs index b4c1af2b79..b8b1bbf287 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications private readonly INotificationsRepository _notificationsRepo; private readonly IUserManager _userManager; - private readonly TimeSpan _frequency = TimeSpan.FromHours(1); + private readonly TimeSpan _frequency = TimeSpan.FromHours(3); private readonly TimeSpan _maxAge = TimeSpan.FromDays(31); public RemoteNotifications(IApplicationPaths appPaths, ILogger logger, IHttpClient httpClient, IJsonSerializer json, INotificationsRepository notificationsRepo, IUserManager userManager) @@ -58,16 +58,13 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications var lastRunTime = File.Exists(dataPath) ? File.GetLastWriteTimeUtc(dataPath) : DateTime.MinValue; - if ((DateTime.UtcNow - lastRunTime) >= _frequency) + try { - try - { - await DownloadNotifications(dataPath, lastRunTime).ConfigureAwait(false); - } - catch (Exception ex) - { - _logger.ErrorException("Error downloading remote notifications", ex); - } + await DownloadNotifications(dataPath, lastRunTime).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error downloading remote notifications", ex); } } @@ -103,7 +100,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications { // Only show notifications that are active, new since last download, and not older than max age var notificationList = notifications - .Where(i => string.Equals(i.active, "1") && i.date > lastRunTime && (DateTime.Now - i.date) <= _maxAge) + .Where(i => string.Equals(i.active, "1") && i.date.ToUniversalTime() > lastRunTime && (DateTime.Now - i.date.ToUniversalTime()) <= _maxAge) .ToList(); foreach (var user in _userManager.Users.ToList()) |
