I am running several Restify services in separate processes. One of them is special because it needs to be up and listening before all of the others even start.
Assume that I cannot use IPC. This leaves me with HTTP clients that attempt to contact the special service ad infinitum, waiting until it gets an answer.
Hence this client with intentionally extreme options.
const client = restify.createStringClient({
url,
retry: {
retries: Infinity,
},
});
// Inside a promise
client.get(endpoint, function(err, req, res, data) {
if (err) {
reject(err);
} else {
// ...
// Probably not needed for GET, but here anyway.
req.end();
resolve(data);
}
});
No matter how I configure the client, I still immediately get socket hang up
errors. I want the nodeback to never fire until it finally reaches the service.
What do I need to do to my configuration to accomplish this?
via Sage Gerard
No comments:
Post a Comment