summaryrefslogtreecommitdiffstats
path: root/src/server/Jobs/JobRegister.cs
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-01-23 18:42:59 +0100
committerivarlovlie <git@ivarlovlie.no>2022-01-23 18:42:59 +0100
commit2d1d7019cbe051d2a42350a6f9d50e1f4ed8bd11 (patch)
tree9a2dd00e28484d891ad683827790d5b839f6c45a /src/server/Jobs/JobRegister.cs
parentad8a8095e3942dc8c33c89a41a3ad31200a60472 (diff)
downloadbookmark-thing-2d1d7019cbe051d2a42350a6f9d50e1f4ed8bd11.tar.xz
bookmark-thing-2d1d7019cbe051d2a42350a6f9d50e1f4ed8bd11.zip
feat: Remove stale tokens on a regular basis
Diffstat (limited to 'src/server/Jobs/JobRegister.cs')
-rw-r--r--src/server/Jobs/JobRegister.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/Jobs/JobRegister.cs b/src/server/Jobs/JobRegister.cs
new file mode 100644
index 0000000..98eac97
--- /dev/null
+++ b/src/server/Jobs/JobRegister.cs
@@ -0,0 +1,18 @@
+using Quartz;
+
+namespace IOL.BookmarkThing.Server.Jobs;
+
+public static class JobRegister
+{
+ public static readonly JobKey TokenCleanupKey = new("TokenCleanupJob");
+
+ public static IServiceCollectionQuartzConfigurator RegisterJobs(this IServiceCollectionQuartzConfigurator configurator) {
+ configurator.AddJob<TokenCleanupJob>(TokenCleanupKey);
+ configurator.AddTrigger(options => {
+ options.ForJob(TokenCleanupKey)
+ .WithIdentity(TokenCleanupKey.Name + "-trigger")
+ .WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(1, 0));
+ });
+ return configurator;
+ }
+}