Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part-2: Implementing Cron Scheduler to daily update GitHub repositories
- Loading branch information
1 parent
ca948ac
commit acee592
Showing
5 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
module.exports = { | ||
"port": process.env.PORT || 3000, | ||
"environment": "dev", | ||
"mongoDbUri": process.env.MONGODB_URI || "mongodb://localhost/github-consumer" | ||
"mongoDbUri": process.env.MONGODB_URI || "mongodb://localhost/github-consumer", | ||
"githubEndpoint": "https://api.github.com/graphql", | ||
"githubAccessToken": process.env.GITHUB_ACCESS_TOKEN | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const RepositoryController = require('./repository.controller'); | ||
const CronJob = require('cron').CronJob; | ||
|
||
function updateDaily() { | ||
RepositoryController.updateRepositories(); | ||
} | ||
|
||
exports.startCronJobs = function () { | ||
new CronJob('0 0 * * *', function () { | ||
updateDaily() | ||
}, null, true, 'UTC'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters