1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed: Processing more than 3 concurrent Automatic Searches should no longer freeze on mono.

This commit is contained in:
Taloth Saldono 2014-06-07 12:40:33 +02:00
parent d2615cd831
commit 17482cb6c1

View File

@ -77,8 +77,12 @@ public Command PublishCommandAsync<TCommand>(TCommand command) where TCommand :
_trackCommands.Store(command);
// TODO: We should use async await (once we get 4.5) or normal Task Continuations on Command processing to prevent blocking the TaskScheduler.
// For now we use TaskCreationOptions 0x10, which is actually .net 4.5 HideScheduler.
// This will detach the scheduler from the thread, causing new Task creating in the command to be executed on the ThreadPool, avoiding a deadlock.
// Please note that the issue only shows itself on mono because since Microsoft .net implementation supports Task inlining on WaitAll.
_taskFactory.StartNew(() => ExecuteCommand<TCommand>(command)
, TaskCreationOptions.PreferFairness)
, TaskCreationOptions.PreferFairness | (TaskCreationOptions)0x10)
.LogExceptions();
return command;