Don't break if cron schedule is missing

This commit is contained in:
Ajay Ramachandran
2021-07-15 13:55:02 -04:00
parent 49e1e38f05
commit 72e17b06fc

View File

@@ -56,8 +56,12 @@ export const archiveDownvoteSegment = async (dayLimit: number, voteLimit: number
};
const DownvoteSegmentArchiveJob = new CronJob(
jobConfig?.schedule || new Date(1),
jobConfig?.schedule || "0 0 * * * 0",
() => archiveDownvoteSegment(jobConfig?.timeThresholdInDays, jobConfig?.voteThreshold)
);
if (serverConfig?.crons?.enabled && jobConfig && !jobConfig.schedule) {
Logger.error("Invalid cron schedule for downvoteSegmentArchive");
}
export default DownvoteSegmentArchiveJob;