Remove nullable, add async task

This commit is contained in:
crobibero 2020-06-18 07:11:46 -06:00
parent 116284fe99
commit 9a51f484af
21 changed files with 19 additions and 60 deletions

View File

@ -1,4 +1,3 @@
#nullable enable
#pragma warning disable CA1801 #pragma warning disable CA1801
using System; using System;

View File

@ -1,5 +1,3 @@
#nullable enable
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Jellyfin.Api.Constants; using Jellyfin.Api.Constants;

View File

@ -1,5 +1,3 @@
#nullable enable
using System; using System;
using Jellyfin.Api.Constants; using Jellyfin.Api.Constants;
using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Devices;

View File

@ -1,5 +1,4 @@
#nullable enable #pragma warning disable CA1801
#pragma warning disable CA1801
using System; using System;
using System.Linq; using System.Linq;

View File

@ -1,5 +1,3 @@
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;

View File

@ -1,4 +1,3 @@
#nullable enable
#pragma warning disable CA1801 #pragma warning disable CA1801
using System.ComponentModel; using System.ComponentModel;

View File

@ -1,4 +1,3 @@
#nullable enable
#pragma warning disable CA1801 #pragma warning disable CA1801
using System; using System;
@ -175,20 +174,18 @@ namespace Jellyfin.Api.Controllers
{ {
CollectionFolder.OnCollectionFolderChange(); CollectionFolder.OnCollectionFolderChange();
Task.Run(() => Task.Run(async () =>
{ {
// No need to start if scanning the library because it will handle it // No need to start if scanning the library because it will handle it
if (refreshLibrary) if (refreshLibrary)
{ {
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None); await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
} }
else else
{ {
// Need to add a delay here or directory watchers may still pick up the changes // Need to add a delay here or directory watchers may still pick up the changes
var task = Task.Delay(1000);
// Have to block here to allow exceptions to bubble // Have to block here to allow exceptions to bubble
Task.WaitAll(task); await Task.Delay(1000).ConfigureAwait(false);
_libraryMonitor.Start(); _libraryMonitor.Start();
} }
}); });
@ -230,20 +227,18 @@ namespace Jellyfin.Api.Controllers
} }
finally finally
{ {
Task.Run(() => Task.Run(async () =>
{ {
// No need to start if scanning the library because it will handle it // No need to start if scanning the library because it will handle it
if (refreshLibrary) if (refreshLibrary)
{ {
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None); await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
} }
else else
{ {
// Need to add a delay here or directory watchers may still pick up the changes // Need to add a delay here or directory watchers may still pick up the changes
var task = Task.Delay(1000);
// Have to block here to allow exceptions to bubble // Have to block here to allow exceptions to bubble
Task.WaitAll(task); await Task.Delay(1000).ConfigureAwait(false);
_libraryMonitor.Start(); _libraryMonitor.Start();
} }
}); });
@ -304,20 +299,18 @@ namespace Jellyfin.Api.Controllers
} }
finally finally
{ {
Task.Run(() => Task.Run(async () =>
{ {
// No need to start if scanning the library because it will handle it // No need to start if scanning the library because it will handle it
if (refreshLibrary) if (refreshLibrary)
{ {
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None); await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
} }
else else
{ {
// Need to add a delay here or directory watchers may still pick up the changes // Need to add a delay here or directory watchers may still pick up the changes
var task = Task.Delay(1000);
// Have to block here to allow exceptions to bubble // Have to block here to allow exceptions to bubble
Task.WaitAll(task); await Task.Delay(1000).ConfigureAwait(false);
_libraryMonitor.Start(); _libraryMonitor.Start();
} }
}); });

View File

@ -1,4 +1,3 @@
#nullable enable
#pragma warning disable CA1801 #pragma warning disable CA1801
using System; using System;

View File

@ -1,5 +1,3 @@
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;

View File

@ -1,5 +1,4 @@
#nullable enable #pragma warning disable CA1801
#pragma warning disable CA1801
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1,5 +1,3 @@
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -21,7 +19,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Jellyfin.Api.Controllers.Images namespace Jellyfin.Api.Controllers
{ {
/// <summary> /// <summary>
/// Remote Images Controller. /// Remote Images Controller.

View File

@ -1,4 +1,3 @@
#nullable enable
#pragma warning disable CA1801 #pragma warning disable CA1801
using System; using System;

View File

@ -1,5 +1,3 @@
#nullable enable
using System; using System;
using System.Net.Mime; using System.Net.Mime;
using System.Threading; using System.Threading;

View File

@ -1,5 +1,3 @@
#nullable enable
namespace Jellyfin.Api.Models.ConfigurationDtos namespace Jellyfin.Api.Models.ConfigurationDtos
{ {
/// <summary> /// <summary>

View File

@ -1,5 +1,3 @@
#nullable enable
using System; using System;
using MediaBrowser.Model.Notifications; using MediaBrowser.Model.Notifications;

View File

@ -1,5 +1,3 @@
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1,5 +1,3 @@
#nullable enable
using MediaBrowser.Model.Notifications; using MediaBrowser.Model.Notifications;
namespace Jellyfin.Api.Models.NotificationDtos namespace Jellyfin.Api.Models.NotificationDtos

View File

@ -1,6 +1,4 @@
#nullable enable using System;
using System;
namespace Jellyfin.Api.Models.PluginDtos namespace Jellyfin.Api.Models.PluginDtos
{ {

View File

@ -1,6 +1,4 @@
#nullable enable namespace Jellyfin.Api.Models.PluginDtos
namespace Jellyfin.Api.Models.PluginDtos
{ {
/// <summary> /// <summary>
/// Plugin security info. /// Plugin security info.

View File

@ -1,5 +1,3 @@
#nullable disable
namespace Jellyfin.Api.Models.StartupDtos namespace Jellyfin.Api.Models.StartupDtos
{ {
/// <summary> /// <summary>
@ -10,16 +8,16 @@ namespace Jellyfin.Api.Models.StartupDtos
/// <summary> /// <summary>
/// Gets or sets UI language culture. /// Gets or sets UI language culture.
/// </summary> /// </summary>
public string UICulture { get; set; } public string? UICulture { get; set; }
/// <summary> /// <summary>
/// Gets or sets the metadata country code. /// Gets or sets the metadata country code.
/// </summary> /// </summary>
public string MetadataCountryCode { get; set; } public string? MetadataCountryCode { get; set; }
/// <summary> /// <summary>
/// Gets or sets the preferred language for the metadata. /// Gets or sets the preferred language for the metadata.
/// </summary> /// </summary>
public string PreferredMetadataLanguage { get; set; } public string? PreferredMetadataLanguage { get; set; }
} }
} }

View File

@ -1,5 +1,3 @@
#nullable disable
namespace Jellyfin.Api.Models.StartupDtos namespace Jellyfin.Api.Models.StartupDtos
{ {
/// <summary> /// <summary>
@ -10,11 +8,11 @@ namespace Jellyfin.Api.Models.StartupDtos
/// <summary> /// <summary>
/// Gets or sets the username. /// Gets or sets the username.
/// </summary> /// </summary>
public string Name { get; set; } public string? Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets the user's password. /// Gets or sets the user's password.
/// </summary> /// </summary>
public string Password { get; set; } public string? Password { get; set; }
} }
} }