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/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 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", });