Added an API endpoint that triggers an RSS campaign.
This commit is contained in:
parent
e786964411
commit
428fb9db7b
8 changed files with 88 additions and 7 deletions
|
@ -17,6 +17,8 @@ const dbCheckInterval = 60 * 1000;
|
|||
|
||||
let running = false;
|
||||
|
||||
let periodicTimeout = null;
|
||||
|
||||
async function fetch(url) {
|
||||
const httpOptions = {
|
||||
uri: url,
|
||||
|
@ -161,9 +163,22 @@ async function run() {
|
|||
|
||||
running = false;
|
||||
|
||||
setTimeout(run, dbCheckInterval);
|
||||
periodicTimeout = setTimeout(run, dbCheckInterval);
|
||||
}
|
||||
|
||||
process.on('message', msg => {
|
||||
if (msg) {
|
||||
const type = msg.type;
|
||||
|
||||
if (type === 'scheduleCheck') {
|
||||
if (periodicTimeout) {
|
||||
clearTimeout(periodicTimeout);
|
||||
setImmediate(run);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (config.title) {
|
||||
process.title = config.title + ': feedcheck';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue