Merge pull request #3369 from crobibero/api-cleanup

Remove #nullable, make Task.Run async
This commit is contained in:
Patrick Barron 2020-06-18 13:22:52 +00:00 committed by GitHub
commit 1da044e0eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 19 additions and 60 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
#nullable enable
#pragma warning disable CA1801
using System;
@ -175,20 +174,18 @@ namespace Jellyfin.Api.Controllers
{
CollectionFolder.OnCollectionFolderChange();
Task.Run(() =>
Task.Run(async () =>
{
// No need to start if scanning the library because it will handle it
if (refreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
}
else
{
// 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
Task.WaitAll(task);
await Task.Delay(1000).ConfigureAwait(false);
_libraryMonitor.Start();
}
});
@ -230,20 +227,18 @@ namespace Jellyfin.Api.Controllers
}
finally
{
Task.Run(() =>
Task.Run(async () =>
{
// No need to start if scanning the library because it will handle it
if (refreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
}
else
{
// 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
Task.WaitAll(task);
await Task.Delay(1000).ConfigureAwait(false);
_libraryMonitor.Start();
}
});
@ -304,20 +299,18 @@ namespace Jellyfin.Api.Controllers
}
finally
{
Task.Run(() =>
Task.Run(async () =>
{
// No need to start if scanning the library because it will handle it
if (refreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
}
else
{
// 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
Task.WaitAll(task);
await Task.Delay(1000).ConfigureAwait(false);
_libraryMonitor.Start();
}
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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