Refactor RepeatingTaskHandler (#796)

* Refactor RepeatingTaskHandler into an ASP.NET service

* Add unit tests for RepeatingTaskService

* Make repeating task unit tests work independent of time

* Fix weird behavior when task is canceled
This commit is contained in:
Josh 2023-06-17 14:48:24 -05:00 committed by GitHub
commit a0d021f1e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 213 additions and 69 deletions

View file

@ -1,4 +1,5 @@
using System.Net;
using LBPUnion.ProjectLighthouse.Administration.Maintenance;
using LBPUnion.ProjectLighthouse.Configuration;
using LBPUnion.ProjectLighthouse.Database;
using LBPUnion.ProjectLighthouse.Logging;
@ -6,6 +7,7 @@ using LBPUnion.ProjectLighthouse.Mail;
using LBPUnion.ProjectLighthouse.Middlewares;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Servers.GameServer.Middlewares;
using LBPUnion.ProjectLighthouse.Services;
using LBPUnion.ProjectLighthouse.Types.Logging;
using LBPUnion.ProjectLighthouse.Types.Mail;
using Microsoft.AspNetCore.Authorization;
@ -63,6 +65,8 @@ public class GameServerStartup
: new NullMailService();
services.AddSingleton(mailService);
services.AddHostedService(provider => new RepeatingTaskService(provider, MaintenanceHelper.RepeatingTasks));
services.Configure<ForwardedHeadersOptions>
(
options =>