aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server')
-rw-r--r--Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs1
-rw-r--r--Jellyfin.Server/Filters/RetryOnTemporarlyUnavailableFilter.cs36
-rw-r--r--Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs4
3 files changed, 38 insertions, 3 deletions
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
index c3b02ad4e..c6c3f21fe 100644
--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
@@ -248,6 +248,7 @@ namespace Jellyfin.Server.Extensions
c.AddSwaggerTypeMappings();
c.SchemaFilter<IgnoreEnumSchemaFilter>();
+ c.OperationFilter<RetryOnTemporarlyUnavailableFilter>();
c.OperationFilter<SecurityRequirementsOperationFilter>();
c.OperationFilter<FileResponseFilter>();
c.OperationFilter<FileRequestFilter>();
diff --git a/Jellyfin.Server/Filters/RetryOnTemporarlyUnavailableFilter.cs b/Jellyfin.Server/Filters/RetryOnTemporarlyUnavailableFilter.cs
new file mode 100644
index 000000000..74470eda0
--- /dev/null
+++ b/Jellyfin.Server/Filters/RetryOnTemporarlyUnavailableFilter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http.Headers;
+using Microsoft.OpenApi.Models;
+using Swashbuckle.AspNetCore.SwaggerGen;
+
+namespace Jellyfin.Server.Filters;
+
+internal class RetryOnTemporarlyUnavailableFilter : IOperationFilter
+{
+ public void Apply(OpenApiOperation operation, OperationFilterContext context)
+ {
+ operation.Responses.Add("503", new OpenApiResponse()
+ {
+ Description = "The server is currently starting or is temporarly not available.",
+ Headers = new Dictionary<string, OpenApiHeader>()
+ {
+ {
+ "Retry-After",
+ new() { AllowEmptyValue = true, Required = false, Description = "A hint for when to retry the operation in full seconds." }
+ },
+ {
+ "Message",
+ new() { AllowEmptyValue = true, Required = false, Description = "A short plain-text reason why the server is not available." }
+ }
+ },
+ Content = new Dictionary<string, OpenApiMediaType>()
+ {
+ {
+ "text/html",
+ new OpenApiMediaType()
+ }
+ }
+ });
+ }
+}
diff --git a/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs
index 08eea0308..214a2f4e6 100644
--- a/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs
+++ b/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs
@@ -248,9 +248,7 @@ public class MigrateLibraryDb : IMigrationRoutine
{
}
- if (reader.TryGetInt32(4, out var sortOrder))
- {
- }
+ int? sortOrder = reader.IsDBNull(4) ? null : reader.GetInt32(4);
personCache.Items.Add(new PeopleBaseItemMap()
{