topliceanu / schedule-drone Goto Github PK
View Code? Open in Web Editor NEWA reliable, fault-tolerant, persistent event scheduler for node.js
A reliable, fault-tolerant, persistent event scheduler for node.js
check the api of rufus
check the api of https://github.com/petreboy14/redis-scheduler
I am playing with your cron module. I've noticed the scheduleAndStore saves the data in the database but it doesn't fire event. I don't know coffeescript but I think may be adding schedule(dataOrCronString, eventName, eventPayload) method on line 68 should resolve the issue.
eg.
store.save data, (err, storedEvent) =>
if err callback err
schedule '* * * * * 1', 'my-cron-event', params
Following is the javascript equivalent.
return store.save(data, function(err, storedEvent) {
if(err) return callback(err);
PersistentScheduler.super.schedule(timestamp, event, payload);
return callback(null, storedEvent);
});
ie. transform the scheduler into a service
scheduleAndStore saves the cron-job in database but it doesn't get active immediate after it's registration. Let have a scenario an user on a live project registered a cron job by hitting an api. It should be active immediate but not working as expected.
`var url = "mongodb://localhost:27017/my-test-db";
drone.setConfig(
{
persistence: {
type: 'mongodb',
connectionString: url,
eventsCollection: 'schedular',
options: {}
}
}
);
scheduler = drone.daemon();
try {
setTimeout(() => {
scheduler.scheduleAndStore('* * * * * * ', 'my-job', {
task: 'sendReport', campaignId: 'abc'
}, function () {
console.log('job registered');
});
}, 3000);
} catch (Exception) {
console.log('Exception', Exception);
}
scheduler.on('my-job', function (params) {
if (params.task == 'sendReport') {
// send campaign email
// sendEmailCampaign(params.campaignId);
}
});`
Old and busted todos
EXPIRE NOTIFY
featureA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.