mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Fixed: Significantly improved api performance.
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
using NzbDrone.Api.Commands;
|
||||
using RestSharp;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using FluentAssertions;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
@@ -9,5 +14,42 @@ namespace NzbDrone.Integration.Test.Client
|
||||
: base(restClient, apiKey)
|
||||
{
|
||||
}
|
||||
|
||||
public CommandResource PostAndWait(CommandResource command)
|
||||
{
|
||||
var result = Post(command);
|
||||
result.Id.Should().NotBe(0);
|
||||
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
if (result.Status == CommandStatus.Completed)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
result = Get(result.Id);
|
||||
}
|
||||
|
||||
Assert.Fail("Command failed");
|
||||
return result;
|
||||
}
|
||||
|
||||
public void WaitAll()
|
||||
{
|
||||
var resources = All();
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
if (!resources.Any(v => v.Status == CommandStatus.Queued || v.Status == CommandStatus.Started))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
resources = All();
|
||||
}
|
||||
|
||||
Assert.Fail("Commands still processing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user