Skip to content

Commit

Permalink
Merge pull request #1156 from hidden4003/periodic-checks-frequency
Browse files Browse the repository at this point in the history
Adjust periodic checks frequency
  • Loading branch information
ElementalCrisis authored Jul 29, 2024
2 parents 187d643 + 89f8b17 commit 09d6dbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Shoko.Server/Scheduling/QuartzStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CheckNetworkAvailabilityJob>(
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
}
Expand Down

0 comments on commit 09d6dbb

Please sign in to comment.