New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dns-endpoint-pool

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dns-endpoint-pool - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

CHANGELOG.md

8

index.js

@@ -86,2 +86,10 @@ var EndpointPool,

getStatus: function () {
var poolStatus = this.poolManager.getStatus();
var endpoints = this.poolManager.endpoints;
return _.assign({
age: Date.now() - this.lastUpdate
}, poolStatus);
},
stopUpdating: function () {

@@ -88,0 +96,0 @@ clearTimeout(this._updateTimeout);

4

package.json
{
"name": "dns-endpoint-pool",
"version": "1.1.0",
"version": "1.2.0",
"description": "Manage and load-balance a pool of service endpoints retrieved from a DNS lookup for a service discovery name.",

@@ -17,3 +17,3 @@ "main": "index.js",

"dependencies": {
"underscore": "=1.7.0"
"underscore": "1.8.3"
},

@@ -20,0 +20,0 @@ "devDependencies": {

@@ -12,2 +12,3 @@ var _ = require('underscore');

this.onEndpointRegistered = options.onEndpointRegistered || _.noop;
this.onEndpointSelected = options.onEndpointSelected || _.noop;
}

@@ -27,2 +28,3 @@

if (this.isInPool(endpoint)) {
this.onEndpointSelected(endpoint);
this._endpointOffset = offset + 1;

@@ -55,2 +57,11 @@ return endpoint;

this.endpoints.push.apply(this.endpoints, newEndpoints);
},
getStatus: function () {
var manager = this;
return {
total: this.endpoints.length,
unhealthy: this.endpoints.reduce(function (badCount, endpoint) {
return badCount + (manager.isInPool(endpoint) ? 0 : 1);
}, 0)
}
}

@@ -96,4 +107,2 @@ };

case HALF_OPEN_READY:
endpoint.state = HALF_OPEN_PENDING; // let one through, then turn it off again
/* falls through */
case CLOSED:

@@ -105,2 +114,7 @@ return true;

},
onEndpointSelected: function (endpoint) {
if (endpoint.state === HALF_OPEN_READY) {
endpoint.state = HALF_OPEN_PENDING; // let one through, then turn it off again
}
},
onEndpointRegistered: function (endpoint) {

@@ -107,0 +121,0 @@ endpoint.state = CLOSED;

@@ -61,2 +61,10 @@ ## DNS Endpoint Pool

### `pool.getStatus()`
Returns an object containing information about the health of the pool. There are three values:
- `total`: The total number of endpoints in the pool, in any status.
- `unhealthy`: The number of endpoints which are unavailable (eg: due to their circuit breaker being open)
- `age`: The number of milliseconds since the last successful update of endpoints.
### `endpoint.url`

@@ -63,0 +71,0 @@

@@ -186,2 +186,3 @@ /*globals it, describe, beforeEach, afterEach */

bazEndpoint,
status,
dep;

@@ -206,2 +207,8 @@

expect(dep.getEndpoint()).to.be(bazEndpoint); // bar is removed
status = dep.getStatus();
expect(status.total).to.be(2);
expect(status.unhealthy).to.be(1);
expect(status.age).to.be.a('number');
dep.stopUpdating();

@@ -208,0 +215,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc