mirror of https://github.com/Radarr/Radarr
Fixed: MediaCovers resizing potentially leaking memory when concurrently executing.
This commit is contained in:
parent
899bd086ec
commit
fed4a0aebe
|
@ -104,7 +104,7 @@ _TeamCity*
|
||||||
# Radarr
|
# Radarr
|
||||||
Backups/
|
Backups/
|
||||||
logs/
|
logs/
|
||||||
MediaCover/
|
#MediaCover/
|
||||||
UpdateLogs/
|
UpdateLogs/
|
||||||
xdg/
|
xdg/
|
||||||
config.xml
|
config.xml
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.MediaCover
|
||||||
|
{
|
||||||
|
public class EnsureMediaCoversCommand : Command
|
||||||
|
{
|
||||||
|
public int MovieId { get; set; }
|
||||||
|
|
||||||
|
public EnsureMediaCoversCommand()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnsureMediaCoversCommand(int movieId)
|
||||||
|
{
|
||||||
|
MovieId = movieId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Movies.Events;
|
using NzbDrone.Core.Movies.Events;
|
||||||
|
@ -24,6 +25,7 @@ namespace NzbDrone.Core.MediaCover
|
||||||
IHandleAsync<MovieUpdatedEvent>,
|
IHandleAsync<MovieUpdatedEvent>,
|
||||||
IHandleAsync<MovieAddedEvent>,
|
IHandleAsync<MovieAddedEvent>,
|
||||||
IHandleAsync<MovieDeletedEvent>,
|
IHandleAsync<MovieDeletedEvent>,
|
||||||
|
IExecute<EnsureMediaCoversCommand>,
|
||||||
IMapCoversToLocal
|
IMapCoversToLocal
|
||||||
{
|
{
|
||||||
private readonly IImageResizer _resizer;
|
private readonly IImageResizer _resizer;
|
||||||
|
@ -32,6 +34,8 @@ namespace NzbDrone.Core.MediaCover
|
||||||
private readonly ICoverExistsSpecification _coverExistsSpecification;
|
private readonly ICoverExistsSpecification _coverExistsSpecification;
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IEventAggregator _eventAggregator;
|
||||||
|
private readonly IManageCommandQueue _commandQueue;
|
||||||
|
private readonly IMovieService _movieService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
private readonly string _coverRootFolder;
|
private readonly string _coverRootFolder;
|
||||||
|
@ -43,6 +47,8 @@ namespace NzbDrone.Core.MediaCover
|
||||||
ICoverExistsSpecification coverExistsSpecification,
|
ICoverExistsSpecification coverExistsSpecification,
|
||||||
IConfigFileProvider configFileProvider,
|
IConfigFileProvider configFileProvider,
|
||||||
IEventAggregator eventAggregator,
|
IEventAggregator eventAggregator,
|
||||||
|
IManageCommandQueue commandQueue,
|
||||||
|
IMovieService movieService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
{
|
{
|
||||||
_resizer = resizer;
|
_resizer = resizer;
|
||||||
|
@ -51,6 +57,8 @@ namespace NzbDrone.Core.MediaCover
|
||||||
_coverExistsSpecification = coverExistsSpecification;
|
_coverExistsSpecification = coverExistsSpecification;
|
||||||
_configFileProvider = configFileProvider;
|
_configFileProvider = configFileProvider;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
_commandQueue = commandQueue;
|
||||||
|
_movieService = movieService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
_coverRootFolder = appFolderInfo.GetMediaCoverPath();
|
_coverRootFolder = appFolderInfo.GetMediaCoverPath();
|
||||||
|
@ -182,16 +190,25 @@ namespace NzbDrone.Core.MediaCover
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Execute(EnsureMediaCoversCommand command)
|
||||||
|
{
|
||||||
|
var movie = _movieService.GetMovie(command.MovieId);
|
||||||
|
EnsureCovers(movie);
|
||||||
|
_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(movie));
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleAsync(MovieUpdatedEvent message)
|
public void HandleAsync(MovieUpdatedEvent message)
|
||||||
{
|
{
|
||||||
EnsureCovers(message.Movie);
|
//EnsureCovers(message.Movie);
|
||||||
_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
_commandQueue.Push(new EnsureMediaCoversCommand(message.Movie.Id));
|
||||||
|
//_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAsync(MovieAddedEvent message)
|
public void HandleAsync(MovieAddedEvent message)
|
||||||
{
|
{
|
||||||
EnsureCovers(message.Movie);
|
//EnsureCovers(message.Movie);
|
||||||
_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
_commandQueue.Push(new EnsureMediaCoversCommand(message.Movie.Id));
|
||||||
|
//_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAsync(MovieDeletedEvent message)
|
public void HandleAsync(MovieDeletedEvent message)
|
||||||
|
|
|
@ -152,6 +152,7 @@
|
||||||
<Compile Include="Extras\Metadata\Consumers\Xbmc\XbmcNfoDetector.cs" />
|
<Compile Include="Extras\Metadata\Consumers\Xbmc\XbmcNfoDetector.cs" />
|
||||||
<Compile Include="Extras\Others\OtherExtraFileRenamer.cs" />
|
<Compile Include="Extras\Others\OtherExtraFileRenamer.cs" />
|
||||||
<Compile Include="Housekeeping\Housekeepers\CleanupOrphanedAlternativeTitles.cs" />
|
<Compile Include="Housekeeping\Housekeepers\CleanupOrphanedAlternativeTitles.cs" />
|
||||||
|
<Compile Include="MediaCover\EnsureMediaCoversCommand.cs" />
|
||||||
<Compile Include="MediaFiles\Commands\UpdateMovieFileQualityCommand.cs" />
|
<Compile Include="MediaFiles\Commands\UpdateMovieFileQualityCommand.cs" />
|
||||||
<Compile Include="MediaFiles\MovieImport\Specifications\GrabbedReleaseQualitySpecification.cs" />
|
<Compile Include="MediaFiles\MovieImport\Specifications\GrabbedReleaseQualitySpecification.cs" />
|
||||||
<Compile Include="MediaFiles\MovieImport\Specifications\SameFileSpecification.cs" />
|
<Compile Include="MediaFiles\MovieImport\Specifications\SameFileSpecification.cs" />
|
||||||
|
@ -1326,4 +1327,4 @@
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue