From 230852a27887f406f3ae953e8801cae5f5127714 Mon Sep 17 00:00:00 2001 From: Cherik Date: Tue, 21 May 2024 17:48:46 +0330 Subject: [PATCH 1/2] remove old config file --- src/features/import-projects/config.ts | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/features/import-projects/config.ts diff --git a/src/features/import-projects/config.ts b/src/features/import-projects/config.ts deleted file mode 100644 index be5f17d..0000000 --- a/src/features/import-projects/config.ts +++ /dev/null @@ -1 +0,0 @@ -export const CRON_SCHEDULE = "0 0 * * *"; // UTC From 7ca39dbe8518416e4880fa62a304f597c1cde969 Mon Sep 17 00:00:00 2001 From: Cherik Date: Tue, 21 May 2024 17:48:56 +0330 Subject: [PATCH 2/2] add IMPORT_PROJECT_CRON_SCHEDULE --- src/constants.ts | 3 +++ src/features/import-projects/index.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 577c2c5..9436bf9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -12,3 +12,6 @@ export const PROJECT_VERIFY_SCHEMA = assertNotNull( ).toLocaleLowerCase(); export const START_BLOCK = parseInt(process.env.START_BLOCK || "5815457"); + +export const IMPORT_PROJECT_CRON_SCHEDULE = + process.env.IMPORT_PROJECT_CRON_SCHEDULE || "0 0 * * *"; // UTC diff --git a/src/features/import-projects/index.ts b/src/features/import-projects/index.ts index 4ef3178..e16eace 100644 --- a/src/features/import-projects/index.ts +++ b/src/features/import-projects/index.ts @@ -1,6 +1,6 @@ import cron from "node-cron"; import { fetchAndProcessGivethProjects } from "./giveth/helpers"; -import { CRON_SCHEDULE } from "./config"; +import { IMPORT_PROJECT_CRON_SCHEDULE } from "../../constants"; export const task = async () => { console.log("Importing Projects", new Date()); @@ -10,7 +10,7 @@ export const task = async () => { export const importProjects = async () => { try { console.log("Importing Projects has been scheduled."); - cron.schedule(CRON_SCHEDULE, task, { + cron.schedule(IMPORT_PROJECT_CRON_SCHEDULE, task, { scheduled: true, timezone: "UTC", });