aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Activity
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Activity')
-rw-r--r--Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs16
-rw-r--r--Emby.Server.Implementations/Activity/ActivityManager.cs6
-rw-r--r--Emby.Server.Implementations/Activity/ActivityRepository.cs16
3 files changed, 20 insertions, 18 deletions
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index 567f139fd..4e448ac64 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -18,6 +18,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using MediaBrowser.Model.Globalization;
+using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.Activity
{
@@ -127,7 +128,7 @@ namespace Emby.Server.Implementations.Activity
{
// Don't report theme song or local trailer playback
return;
- }
+ }
if (e.Users.Count == 0)
{
@@ -159,8 +160,8 @@ namespace Emby.Server.Implementations.Activity
{
// Don't report theme song or local trailer playback
return;
- }
-
+ }
+
if (e.Users.Count == 0)
{
return;
@@ -415,7 +416,7 @@ namespace Emby.Server.Implementations.Activity
{
return;
}
-
+
var time = result.EndTimeUtc - result.StartTimeUtc;
var runningTime = string.Format(_localization.GetLocalizedString("LabelRunningTimeValue"), ToUserFriendlyString(time));
@@ -436,18 +437,18 @@ namespace Emby.Server.Implementations.Activity
{
Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
Type = "ScheduledTaskFailed",
- Overview = string.Join(Environment.NewLine, vals.ToArray()),
+ Overview = string.Join(Environment.NewLine, vals.ToArray(vals.Count)),
ShortOverview = runningTime,
Severity = LogSeverity.Error
});
}
}
- private async void CreateLogEntry(ActivityLogEntry entry)
+ private void CreateLogEntry(ActivityLogEntry entry)
{
try
{
- await _activityManager.Create(entry).ConfigureAwait(false);
+ _activityManager.Create(entry);
}
catch
{
@@ -490,6 +491,7 @@ namespace Emby.Server.Implementations.Activity
//_logManager.LoggerLoaded -= _logManager_LoggerLoaded;
_appHost.ApplicationUpdated -= _appHost_ApplicationUpdated;
+ GC.SuppressFinalize(this);
}
/// <summary>
diff --git a/Emby.Server.Implementations/Activity/ActivityManager.cs b/Emby.Server.Implementations/Activity/ActivityManager.cs
index b6095f082..9a3f1ae47 100644
--- a/Emby.Server.Implementations/Activity/ActivityManager.cs
+++ b/Emby.Server.Implementations/Activity/ActivityManager.cs
@@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.Activity
public class ActivityManager : IActivityManager
{
public event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
-
+
private readonly IActivityRepository _repo;
private readonly ILogger _logger;
private readonly IUserManager _userManager;
@@ -25,12 +25,12 @@ namespace Emby.Server.Implementations.Activity
_userManager = userManager;
}
- public async Task Create(ActivityLogEntry entry)
+ public void Create(ActivityLogEntry entry)
{
entry.Id = Guid.NewGuid().ToString("N");
entry.Date = DateTime.UtcNow;
- await _repo.Create(entry).ConfigureAwait(false);
+ _repo.Create(entry);
EventHelper.FireEventIfNotNull(EntryCreated, this, new GenericEventArgs<ActivityLogEntry>(entry), _logger);
}
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index e9b6f7a40..3dcc50ba3 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
-using System.Threading.Tasks;
using Emby.Server.Implementations.Data;
using MediaBrowser.Controller;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using SQLitePCL.pretty;
+using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.Activity
{
@@ -40,12 +40,12 @@ namespace Emby.Server.Implementations.Activity
private const string BaseActivitySelectText = "select Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity from ActivityLogEntries";
- public Task Create(ActivityLogEntry entry)
+ public void Create(ActivityLogEntry entry)
{
- return Update(entry);
+ Update(entry);
}
- public async Task Update(ActivityLogEntry entry)
+ public void Update(ActivityLogEntry entry)
{
if (entry == null)
{
@@ -94,13 +94,13 @@ namespace Emby.Server.Implementations.Activity
var whereTextWithoutPaging = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray());
+ " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
if (startIndex.HasValue && startIndex.Value > 0)
{
var pagingWhereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray());
+ " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM ActivityLogEntries {0} ORDER BY DateCreated DESC LIMIT {1})",
pagingWhereText,
@@ -109,7 +109,7 @@ namespace Emby.Server.Implementations.Activity
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray());
+ " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
commandText += whereText;
@@ -154,7 +154,7 @@ namespace Emby.Server.Implementations.Activity
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
}
- result.Items = list.ToArray();
+ result.Items = list.ToArray(list.Count);
return result;
}, ReadTransactionMode);