Giter VIP home page Giter VIP logo

cron-cluster's People

Contributors

cernytomas avatar loicmahieu avatar natsuke avatar skeggse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cron-cluster's Issues

fake timer

Test timer must be faked for faster test running
using sinon.js: http://sinonjs.org/

{
    setUp: function () {
        this.clock = sinon.useFakeTimers();
    },

    tearDown: function () {
        this.clock.restore();
    },

    "test should animate element over 500ms" : function(){
        var el = jQuery("<div></div>");
        el.appendTo(document.body);

        el.animate({ height: "200px", width: "200px" });
        this.clock.tick(510);

        assertEquals("200px", el.css("height"));
        assertEquals("200px", el.css("width"));
    }
}

Redis issue

Hi: @Natsuke

I'm using latest redis version, when pass redis client to cron-cluster I got this

Err wrong number of arguments for set command.

This my code

var client = require("redis").createClient();
var CronJob = require('cron-cluster')(client).CronJob

var job = new CronJob('* * * * * *', function () {
console.log("here timer");
})
job.start()

May someone help me with that. tks

CronJob executes function on all instances - FIXED IN PR #5

There is a bug when you are using an object as first parameter of the CronJob instance, like this:

`js
var redis = require('redis').createClient()
var CronJob = require('cron-cluster')(redis).CronJob

function doCron () {
var job = new CronJob({
cronTime: '* * * * * *',
onTick: function () {
// Do some stuff here
}
})
job.start()
}
`

this will create an instance of our application which is not synchronized with the other ones in the cluster.

Bugfix is available here: #5

Modern Alternative?

First of all, thanks for your work on this package, cool that something like this exists! ๐Ÿ™Œ

Considering that this library hasn't received any new commits or publishes in the last 4 years, would you suggest a modern alternative?

Looking at comparison of competing libraries on npm trends, some more low-level alternatives like async-mutex, async-lock and mutexify are suggested.

This seems to be a similar approach to this Stack Overflow answer

Would you suggest using one of these alternatives? Or some different approach?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.