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

Implementing scheduler to keep syncing database #217

Open
Zalasanjay opened this issue Nov 10, 2017 · 0 comments
Open

Implementing scheduler to keep syncing database #217

Zalasanjay opened this issue Nov 10, 2017 · 0 comments

Comments

@Zalasanjay
Copy link

Zalasanjay commented Nov 10, 2017

Hello friends, I've implement scheduler for sync database as per users requirement like user can set as "at 5:00 pm on Weds,Thurs and Fri" or something else like that.

I've configure my later.js code when the user create connection for any database and that time only my scheduler will execute. if user create database connection and my keep_sync scheduler starts. after that if my server restart then what will happen my keep_sync scheduler will also restart or i have to manually need to execute it again?

var http = require('http');
var express = require('express');
var later = require('later');
var app = express();
var port = Number(2200);

later.date.UTC();
later.date.localTime();

var server = http.createServer(app).listen(port, function () {
    console.log('App Runnings on: ', port);
})

var keep_sync = later.parse.text("at 5:00 pm on Weds,Thurs and Fri");
later.setInterval(syncDb, keep_sync);

function syncDb() {
    // my database sync code appends here
} 

Any suggestions how it can be accomplished with later.js?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant