From c60404df00332af7c4d99deaf4097334adaeb8e2 Mon Sep 17 00:00:00 2001 From: hidden4003 Date: Sat, 27 Jul 2024 10:05:48 +0300 Subject: [PATCH 1/2] Adjust anidb ping frequency and logout period --- .../AniDB/UDP/AniDBUDPConnectionHandler.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs b/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs index 0ac56a59b..3cb6090c6 100644 --- a/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs +++ b/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs @@ -23,10 +23,17 @@ namespace Shoko.Server.Providers.AniDB.UDP; #nullable enable public class AniDBUDPConnectionHandler : ConnectionHandler, IUDPConnectionHandler { + /**** + * From Anidb wiki: + * The virtual UDP connection times out if no data was received from the client for 35 minutes. + * A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required. + * If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work. + * If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command. + ****/ + // 25 minutes + private const int LogoutPeriod = 25 * 60 * 1000; // 10 minutes - private const int LogoutPeriod = 10 * 60 * 1000; - // 45 seconds - private const int PingFrequency = 45 * 1000; + private const int PingFrequency = 10 * 60 * 1000; private readonly IRequestFactory _requestFactory; private readonly IConnectivityService _connectivityService; private IAniDBSocketHandler? _socketHandler; From 89f8b1789c92e9e6135ed2b9c645c11a671a3376 Mon Sep 17 00:00:00 2001 From: hidden4003 Date: Sat, 27 Jul 2024 10:09:46 +0300 Subject: [PATCH 2/2] Adjust intetnet availability check frequency --- Shoko.Server/Scheduling/QuartzStartup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shoko.Server/Scheduling/QuartzStartup.cs b/Shoko.Server/Scheduling/QuartzStartup.cs index 1178ae412..77017bfb0 100644 --- a/Shoko.Server/Scheduling/QuartzStartup.cs +++ b/Shoko.Server/Scheduling/QuartzStartup.cs @@ -30,7 +30,7 @@ public static async Task ScheduleRecurringJobs(bool replace) // Also give it a high priority, since it affects Acquisition Filters // StartJobNow gives a priority of 10. We'll give it 20 to be even higher priority await ScheduleRecurringJob( - triggerConfig: t => t.WithPriority(20).WithSimpleSchedule(tr => tr.WithIntervalInMinutes(5).RepeatForever()).StartNow(), replace: true, keepSchedule: false); + triggerConfig: t => t.WithPriority(20).WithSimpleSchedule(tr => tr.WithIntervalInMinutes(30).RepeatForever()).StartNow(), replace: true, keepSchedule: false); // TODO the other schedule-based jobs that are on timers }