Re-enabled scheduled tasks after fixing scheduled lib.

This commit is contained in:
Andrew Lalis 2024-08-05 12:13:35 -04:00
parent 7a34d5bb34
commit 0df816689c
3 changed files with 13 additions and 10 deletions

View File

@ -7,6 +7,7 @@
"handy-httpd": "~>8.4.1",
"proper-d": "~>0.0.2",
"requests": "~>2.1.3",
"scheduled": "~>1.4.0",
"shared-utils": {
"path": "../shared-utils"
}

View File

@ -8,6 +8,7 @@
"path-matcher": "1.2.0",
"proper-d": "0.0.2",
"requests": "2.1.3",
"scheduled": "1.4.0",
"shared-utils": {"path":"../shared-utils"},
"slf4d": "3.0.1",
"streams": "3.5.0",

View File

@ -4,6 +4,7 @@ import handy_httpd.handlers.file_resolving_handler;
import handy_httpd.components.optional;
import slf4d;
import slf4d.default_provider;
import scheduled;
import std.json;
import std.stdio;
@ -43,16 +44,16 @@ void main() {
serversMutex = new Mutex();
lastServerStatusTimestamp = Clock.currTime();
// JobScheduler scheduler = JobScheduler.getDefault();
// scheduler.addJob(
// &removeOldStartupRequests,
// new FixedIntervalSchedule(minutes(5))
// );
// scheduler.addJob(
// &checkForOutOfDateServerStatus,
// new FixedIntervalSchedule(minutes(1))
// );
// scheduler.start();
JobScheduler scheduler = JobScheduler.getDefault();
scheduler.addJob(
&removeOldStartupRequests,
new FixedIntervalSchedule(minutes(5))
);
scheduler.addJob(
&checkForOutOfDateServerStatus,
new FixedIntervalSchedule(minutes(1))
);
scheduler.start();
PathHandler handler = new PathHandler();
handler.addMapping(Method.POST, "/api/servers", &postServerStatus);