Implement cron

Fixes #22
This commit is contained in:
Dessa Simpson 2020-11-28 22:05:08 -07:00
parent 42d2a4a78c
commit a86e8a5667
9 changed files with 161 additions and 63 deletions

11
db/10-cron.sql Normal file
View file

@ -0,0 +1,11 @@
CREATE TABLE cron (
jobName varchar UNIQUE NOT NULL, -- Application-recognizable name for the job
runinterval interval NOT NULL, -- Duration between runs
-- Last successful run - only gets updated if run is successful
lastSuccess timestamptz DEFAULT to_timestamp(0), -- Defaults to beginning of time
PRIMARY KEY(jobName)
);
INSERT INTO cron (jobName,runInterval) VALUES
('processBans','30 minutes'),
('processEmptyMetadata','1 day');