INNER CODE UNIT · JavaScript
found
pnxtech/hydra · index.js:1427
let found = instances.filter((entry) => entry.instanceID === instance);
if (found.length > 0) {
this._sendMessageThroughChannel(`${mcMessageKey}:${serviceName}:${instance}`, message);
} else {
let msg = `Unavailable ${serviceName} instance named ${instance}`;
this._logMessage('error', msg);
resolve(this._createServerResponseWithReason(ServerResponse.HTTP_SERVICE_UNAVAILABLE, msg));
return;
}
} else {
// Send to a random service. It's random beause currently _getServicePresence()
// returns a shuffled array.
let serviceInstance = instances[0];
this._sendMessageThroughChannel(`${mcMessageKey}:${serviceName}:${serviceInstance.instanceID}`, message);
}
resolve();
})
.catch((err) => {