mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
updated CommandExecutedEvent to be handled sync.
This commit is contained in:
parent
eb7dda0629
commit
48c06de098
@ -67,7 +67,6 @@
|
||||
<Compile Include="EnsureTest\PathExtensionFixture.cs" />
|
||||
<Compile Include="EnvironmentTests\StartupArgumentsFixture.cs" />
|
||||
<Compile Include="EnvironmentTests\EnvironmentProviderTest.cs" />
|
||||
<Compile Include="MessagingTests\MessageAggregatorEventTests.cs" />
|
||||
<Compile Include="ReflectionExtensions.cs" />
|
||||
<Compile Include="PathExtensionFixture.cs" />
|
||||
<Compile Include="DiskProviderTests\DiskProviderFixture.cs" />
|
||||
|
@ -4,15 +4,15 @@
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Messaging;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Common.Test.MessagingTests
|
||||
namespace NzbDrone.Core.Test.Messaging.Events
|
||||
{
|
||||
[TestFixture]
|
||||
public class MessageAggregatorEventTests : TestBase<EventAggregator>
|
||||
public class EventAggregatorFixture : TestBase<EventAggregator>
|
||||
{
|
||||
private Mock<IHandle<EventA>> HandlerA1;
|
||||
private Mock<IHandle<EventA>> HandlerA2;
|
||||
@ -119,11 +119,11 @@ public void should_queue_multiple_async_events()
|
||||
|
||||
AsyncHandlerA1.Setup(c => c.HandleAsync(It.IsAny<EventA>()))
|
||||
.Callback<EventA>(c =>
|
||||
{
|
||||
var id = counter.Start();
|
||||
Thread.Sleep(1000);
|
||||
counter.Stop(id);
|
||||
});
|
||||
{
|
||||
var id = counter.Start();
|
||||
Thread.Sleep(1000);
|
||||
counter.Stop(id);
|
||||
});
|
||||
|
||||
Subject.PublishEvent(eventA);
|
||||
|
||||
@ -143,5 +143,4 @@ public class EventB : IEvent
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -150,6 +150,7 @@
|
||||
<Compile Include="Messaging\Commands\CommandEqualityComparerFixture.cs" />
|
||||
<Compile Include="Messaging\Commands\CommandExecutorFixture.cs" />
|
||||
<Compile Include="Messaging\Commands\CommandFixture.cs" />
|
||||
<Compile Include="Messaging\Events\EventAggregatorFixture.cs" />
|
||||
<Compile Include="MetadataSourceTests\TraktProxyFixture.cs" />
|
||||
<Compile Include="NotificationTests\NotificationServiceFixture.cs" />
|
||||
<Compile Include="NotificationTests\Xbmc\GetJsonVersionFixture.cs" />
|
||||
|
@ -6,7 +6,6 @@
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation
|
||||
|
@ -3,7 +3,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
@ -9,7 +9,6 @@
|
||||
using NzbDrone.Core.Instrumentation.Commands;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.Messaging;
|
||||
using NzbDrone.Core.Messaging.Commands.Tracking;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -23,7 +22,7 @@ public interface ITaskManager
|
||||
IList<ScheduledTask> GetPending();
|
||||
}
|
||||
|
||||
public class TaskManager : ITaskManager, IHandle<ApplicationStartedEvent>, IHandleAsync<CommandExecutedEvent>, IHandleAsync<ConfigSavedEvent>
|
||||
public class TaskManager : ITaskManager, IHandle<ApplicationStartedEvent>, IHandle<CommandExecutedEvent>, IHandleAsync<ConfigSavedEvent>
|
||||
{
|
||||
private readonly IScheduledTaskRepository _scheduledTaskRepository;
|
||||
private readonly IConfigService _configService;
|
||||
@ -79,7 +78,7 @@ public void Handle(ApplicationStartedEvent message)
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleAsync(CommandExecutedEvent message)
|
||||
public void Handle(CommandExecutedEvent message)
|
||||
{
|
||||
var scheduledTask = _scheduledTaskRepository.All().SingleOrDefault(c => c.TypeName == message.Command.GetType().FullName);
|
||||
|
||||
@ -97,4 +96,4 @@ public void HandleAsync(ConfigSavedEvent message)
|
||||
_scheduledTaskRepository.Update(rss);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user