diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-05-11 10:15:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-11 10:15:35 +0200 |
| commit | dabd67d12770d4444b06e5a8a5b1a777b431f80b (patch) | |
| tree | 56cabc231a9a4c3c242582fc024884a2df631808 /Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs | |
| parent | f33876e7e351129ea2296b537b38f9c87fd67b70 (diff) | |
| parent | 1666f3ca148c38609c85cb81e1e8b69e3473e319 (diff) | |
Merge pull request #2900 from mark-monteiro/migration-dependency-injection
Use dependency injection to construct migration routines
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs')
| -rw-r--r-- | Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs b/Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs index 6f8e4a8ff..b2e957d5b 100644 --- a/Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs +++ b/Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs @@ -10,6 +10,15 @@ namespace Jellyfin.Server.Migrations.Routines /// </summary> internal class DisableTranscodingThrottling : IMigrationRoutine { + private readonly ILogger _logger; + private readonly IConfigurationManager _configManager; + + public DisableTranscodingThrottling(ILogger<DisableTranscodingThrottling> logger, IConfigurationManager configManager) + { + _logger = logger; + _configManager = configManager; + } + /// <inheritdoc/> public Guid Id => Guid.Parse("{4124C2CD-E939-4FFB-9BE9-9B311C413638}"); @@ -17,16 +26,16 @@ namespace Jellyfin.Server.Migrations.Routines public string Name => "DisableTranscodingThrottling"; /// <inheritdoc/> - public void Perform(CoreAppHost host, ILogger logger) + public void Perform() { // Set EnableThrottling to false since it wasn't used before and may introduce issues - var encoding = ((IConfigurationManager)host.ServerConfigurationManager).GetConfiguration<EncodingOptions>("encoding"); + var encoding = _configManager.GetConfiguration<EncodingOptions>("encoding"); if (encoding.EnableThrottling) { - logger.LogInformation("Disabling transcoding throttling during migration"); + _logger.LogInformation("Disabling transcoding throttling during migration"); encoding.EnableThrottling = false; - host.ServerConfigurationManager.SaveConfiguration("encoding", encoding); + _configManager.SaveConfiguration("encoding", encoding); } } } |
