Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make first poll occur immediately on run

  • Loading branch information...
commit ad286fe05ef11ac060a4303ce07b664fad8155bf 1 parent 4d1e42e
@DukeyToo DukeyToo authored
Showing with 10 additions and 3 deletions.
  1. +7 −2 bin/proxy.js
  2. +3 −1 lib/main.js
View
9 bin/proxy.js
@@ -28,7 +28,8 @@ parser.on("server", function(config, callback) {
perfectapi.proxy(endpoint, function(err, registry) {
//now we have a reference to the registry running on the same machine
- setInterval(function() {
+
+ var poller = function() {
var config = {}
registry.listServices(config, function(err, result) {
if (err) return console.log(err);
@@ -37,7 +38,11 @@ parser.on("server", function(config, callback) {
if (err) return console.log(err);
});
})
- }, pollInterval);
+ }
+
+ poller();
+
+ setInterval(poller, pollInterval);
});
})
View
4 lib/main.js
@@ -9,8 +9,10 @@ exports.poll = function(registry, serviceNames, callback) {
async.forEach(serviceNames, function(serviceName, cb) {
var config = {name: serviceName};
- console.log(serviceName)
+
registry.getServiceInfo(config, function(err, result) {
+ if (err) return cb(err);
+
console.log(result);
async.filter(result, function(instance, cb2) {
cb2(instance.host && instance.host.toLowerCase() == hostName);
Please sign in to comment.
Something went wrong with that request. Please try again.