Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 min schedule for staging added with a console to verify #40

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion controller/createVNubanController.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,13 @@ const createVNuban = (req, res) => {
preferredBanks: ["232"]
}, champ)
})
res.status(200).json(champs);

if (appConfig.ENVIRONMENT != 'production') {
console.log("vNuban creation started");
}
if (req) {
res.status(200).json(champs);
}
})
};

Expand Down
9 changes: 8 additions & 1 deletion cronjob.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fetch from "node-fetch";
import schedule from "node-schedule";
import createVNuban from "./controller/createVNubanController.js";
import appConfig from './configs/appConfig.js';

const postSlackMessage = async (message) => {

Expand Down Expand Up @@ -100,7 +101,13 @@ const initCronJob = () => {
const initVNubanCronJob = () => {
//run between 9 AM WAT to 9 PM WAT except Sundays at interval of 2 hours
// (minute, hour, day(month), month, day(week))
const jobInterval = '0 9-21/2 * * 1-6'
let jobInterval = '0 9-21/2 * * 1-6';

if (appConfig.ENVIRONMENT != 'production') {
// In staging, run every 5 minutes
jobInterval = '*/5 * * * *';
}

const job1 = schedule.scheduleJob(jobInterval, () => {
try {
createVNuban()
Expand Down