Skip to content

Commit

Permalink
Queue Manual Import commands at high priority
Browse files Browse the repository at this point in the history
(cherry picked from commit 64c6a8879beb1b17122c8f6f74bf7b3cf4dd1570)
  • Loading branch information
markus101 authored and mynameisbogdan committed Mar 3, 2024
1 parent 33b12a5 commit fb1b727
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Lidarr.Api.V1/Commands/CommandController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using NzbDrone.Common.Serializer;
using NzbDrone.Common.TPL;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.MediaFiles.TrackImport.Manual;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ProgressMessaging;
Expand Down Expand Up @@ -61,6 +62,9 @@ public ActionResult<CommandResource> StartCommand(CommandResource commandResourc
using (var reader = new StreamReader(Request.Body))
{
var body = reader.ReadToEnd();
var priority = commandType == typeof(ManualImportCommand)
? CommandPriority.High
: CommandPriority.Normal;

dynamic command = STJson.Deserialize(body, commandType);

Expand All @@ -69,7 +73,8 @@ public ActionResult<CommandResource> StartCommand(CommandResource commandResourc
command.SendUpdatesToClient = true;
command.ClientUserAgent = Request.Headers["UserAgent"];

var trackedCommand = _commandQueueManager.Push(command, CommandPriority.Normal, CommandTrigger.Manual);
var trackedCommand = _commandQueueManager.Push(command, priority, CommandTrigger.Manual);

return Created(trackedCommand.Id);
}
}
Expand Down

0 comments on commit fb1b727

Please sign in to comment.