old_contents: module.exports = function() {
    var scheduler = {
      domain: require('domain').create(),
  
      initialize: function() {
        this.domain.on("error", function(error) {
          console.error(error.stack);
        });
      },
  
      schedule: function(callback, millis) {
        if (!millis){
          console.error ("No interval defined");
         return;
        }
        var errorHandlingCallBack = this.domain.bind(callback);
        setInterval(errorHandlingCallBack, millis);
        errorHandlingCallBack();
      }
    };
    scheduler.initialize();
    return scheduler;
  };
  
new_contents: module.exports = function() {
    var scheduler = {
      domain: require('domain').create(),
  
      initialize: function() {
        this.domain.on("error", function(error) {
          console.error(error.stack);
        });
      },
  
      schedule: function(callback, millis) {
        if (!millis){
          console.error ("No interval defined");
         return;
        }
        var thiz = this;
        var errorHandlingCallBack = this.domain.bind(callback);
        setTimeout(function(){
          errorHandlingCallBack();
          thiz.schedule(callback, millis);
        }, millis);
  
        errorHandlingCallBack();
      }
    };
    scheduler.initialize();
    return scheduler;
  };
  
subject: Use setTimeout to avoid job overlaping