mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
fixed a concurrency issue with job provider.
This commit is contained in:
parent
8fca3c3419
commit
0d02b0538b
2 changed files with 29 additions and 3 deletions
|
@ -100,6 +100,29 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
}
|
||||
|
||||
[Test]
|
||||
//This test will confirm that the concurrency checks are rest
|
||||
//after execution so the job can successfully run.
|
||||
public void no_concurent_jobs()
|
||||
{
|
||||
IEnumerable<IJob> fakeJobs = new List<IJob> { new SlowJob() };
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||
mocker.SetConstant(fakeJobs);
|
||||
|
||||
var timerProvider = mocker.Resolve<JobProvider>();
|
||||
timerProvider.Initialize();
|
||||
var firstRun = timerProvider.QueueJob(typeof(SlowJob),1);
|
||||
var secondRun = timerProvider.QueueJob(typeof(SlowJob),2);
|
||||
var third = timerProvider.QueueJob(typeof(SlowJob),3);
|
||||
|
||||
|
||||
Thread.Sleep(10000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
//This test will confirm that the concurrency checks are rest
|
||||
//after execution so the job can successfully run.
|
||||
|
@ -436,8 +459,10 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
public void Start(ProgressNotification notification, int targetId)
|
||||
{
|
||||
Console.WriteLine("Starting Job");
|
||||
Thread.Sleep(2000);
|
||||
ExexutionCount++;
|
||||
Console.WriteLine("Finishing Job");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue