Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Make services async #7

Closed
dscape opened this issue Nov 8, 2012 · 6 comments
Closed

Make services async #7

dscape opened this issue Nov 8, 2012 · 6 comments

Comments

@dscape
Copy link

dscape commented Nov 8, 2012

The way you coded this you need to specify resources in a file. It would be useful to do http calls to get a dynamic list of servers to ping.

@dscape
Copy link
Author

dscape commented Nov 8, 2012

e.g.

WatchMen.prototype.start = function (cb){
 var self = this;
 self.daemon_status = 1;

 function launch (service){
   self.ping ({service:service}, function (err, state){
    if (err){ console.error (err); }

    if (self.daemon_status){
     setTimeout(launch, parseInt(state.next_attempt_secs, 10) * 1000, service);
    }
   });
 }

 this.services(function (err, services) {
   if(err) {
     console.log("Exiting: " + err.message);
     process.exit();
   }
   services.forEach(function(service){
     if (service.enabled !== false){
      launch(service);
     }
    });

    console.log('watchmen monitor started.');
    cb();
 });
};

@iloire
Copy link
Owner

iloire commented Nov 11, 2012

Yes, resolving dynamically what servers to ping would be nice (so you can keep them in a database and add/remove services while the process is running). Now you have to change the config file and restart the process, what is not as good.

@ericelliott
Copy link
Contributor

I see this issue was opened 3 years ago... is this actively maintained?

@iloire
Copy link
Owner

iloire commented Feb 23, 2015

@ericelliott Yes, it is. I guess nobody has issued a PR for this yet... If you do, I will happily review it and merge it.

@ericelliott
Copy link
Contributor

👍

iloire pushed a commit that referenced this issue Mar 22, 2015
@iloire
Copy link
Owner

iloire commented Mar 22, 2015

Thanks for raising this issue. This has been Implemented in b8b5bb5

@iloire iloire closed this as completed Mar 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants