From acd0e5d8fc1e606b200508ce2b949ed88703fb35 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Mon, 13 Jan 2025 18:24:09 +0100 Subject: [PATCH 1/2] update bootstrap.js adding check endaoment --- src/server/bootstrap.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/bootstrap.ts b/src/server/bootstrap.ts index 5d6d9a74b..576822a67 100644 --- a/src/server/bootstrap.ts +++ b/src/server/bootstrap.ts @@ -71,6 +71,7 @@ import { runCheckPendingUserModelScoreCronjob } from '../services/cronJobs/syncU import { isTestEnv } from '../utils/utils'; import { refreshProjectEstimatedMatchingView } from '../services/projectViewsService'; import { runSyncEstimatedClusterMatchingCronjob } from '../services/cronJobs/syncEstimatedClusterMatchingJob'; +import { runCheckAndUpdateEndaomentProject } from '../services/cronJobs/checkAndUpdateEndaomentProject'; Resource.validate = validate; @@ -362,6 +363,7 @@ export async function bootstrap() { runCheckPendingRecurringDonationsCronJob(); runNotifyMissingDonationsCronJob(); runCheckPendingProjectListingCronJob(); + runCheckAndUpdateEndaomentProject(); if (process.env.ENABLE_CLUSTER_MATCHING === 'true') { runSyncEstimatedClusterMatchingCronjob(); From e9ea066e7177e5aab3016e7f17b9e649bd2fb730 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Mon, 13 Jan 2025 18:42:40 +0100 Subject: [PATCH 2/2] adding sitemap cronjob to bootstrap --- src/server/bootstrap.ts | 5 +++++ src/services/cronJobs/generateSitemapOnFrontend.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/server/bootstrap.ts b/src/server/bootstrap.ts index 576822a67..527567d95 100644 --- a/src/server/bootstrap.ts +++ b/src/server/bootstrap.ts @@ -72,6 +72,7 @@ import { isTestEnv } from '../utils/utils'; import { refreshProjectEstimatedMatchingView } from '../services/projectViewsService'; import { runSyncEstimatedClusterMatchingCronjob } from '../services/cronJobs/syncEstimatedClusterMatchingJob'; import { runCheckAndUpdateEndaomentProject } from '../services/cronJobs/checkAndUpdateEndaomentProject'; +import { runGenerateSitemapOnFrontend } from '../services/cronJobs/generateSitemapOnFrontend'; Resource.validate = validate; @@ -378,6 +379,10 @@ export async function bootstrap() { runCheckPendingUserModelScoreCronjob(); } + if (process.env.SITEMAP_CRON_SECRET !== '') { + runGenerateSitemapOnFrontend(); + } + // If we need to deactivate the process use the env var NO MORE // if (process.env.GIVING_BLOCKS_SERVICE_ACTIVE === 'true') { // runGivingBlocksProjectSynchronization(); diff --git a/src/services/cronJobs/generateSitemapOnFrontend.ts b/src/services/cronJobs/generateSitemapOnFrontend.ts index c8cbfe626..371d38cdd 100644 --- a/src/services/cronJobs/generateSitemapOnFrontend.ts +++ b/src/services/cronJobs/generateSitemapOnFrontend.ts @@ -9,9 +9,12 @@ */ import { schedule } from 'node-cron'; import axios from 'axios'; +import config from '../../config'; import { logger } from '../../utils/logger'; -const cronJobTime = '0 0 * * 0'; // Every Sunday at 00:00 +// Every Sunday at 00:00 +const cronJobTime = + (config.get('GENERATE_SITEMAP_CRONJOB_EXPRESSION') as string) || '0 0 * * 0'; export const runGenerateSitemapOnFrontend = () => { logger.debug(