mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
25 lines
856 B
TypeScript
25 lines
856 B
TypeScript
import { EVERY_THREE_HOURS, EVERY_FIVE_MINUTE } from "Common/Utils/CronTime";
|
|
import { IsDevelopment } from "Common/Server/EnvironmentConfig";
|
|
import BasicCron from "Common/Server/Utils/BasicCron";
|
|
import logger from "Common/Server/Utils/Logger";
|
|
import CodeRepositoryUtil from "Common/Server/Utils/CodeRepository/CodeRepository";
|
|
import { BlogRootPath } from "../Utils/Config";
|
|
import BlogPostUtil from "../Utils/BlogPost";
|
|
|
|
BasicCron({
|
|
jobName: "Home:UpdateBlog",
|
|
options: {
|
|
schedule: IsDevelopment ? EVERY_FIVE_MINUTE : EVERY_THREE_HOURS,
|
|
runOnStartup: true,
|
|
},
|
|
runFunction: async () => {
|
|
logger.debug("UpdateBlog: Start");
|
|
// Pull latest changes from the repository
|
|
await CodeRepositoryUtil.pullChanges({
|
|
repoPath: BlogRootPath,
|
|
});
|
|
BlogPostUtil.clearAllCaches();
|
|
logger.debug("UpdateBlog: End");
|
|
},
|
|
});
|