Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@abtnode/util

Package Overview
Dependencies
Maintainers
3
Versions
781
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtnode/util - npm Package Compare versions

Comparing version 1.3.5 to 1.3.6

2

lib/constants.js

@@ -186,3 +186,3 @@ const NODE_SERVICES = Object.freeze({

// Service Gateway
DEFAULT_ROUTER_PROVIDER: 'none',
ROUTER_PROVIDER_NONE: 'none',
DOMAIN_FOR_IP_SITE: '',

@@ -189,0 +189,0 @@ DOMAIN_FOR_IP_SITE_REGEXP: `~^\\d+.\\d+.\\d+.\\d+$`, // eslint-disable-line

@@ -9,6 +9,6 @@ const net = require('net');

const dial = (port) =>
const dial = (host, port) =>
new Promise((resolve, reject) => {
const socket = net.connect({
host: '127.0.0.1',
host: host || '127.0.0.1',
port,

@@ -27,6 +27,6 @@ });

const ensureStarted = async (port, timeout = 10 * ONE_SECOND, elapse = 0) => {
const ensureStarted = async ({ host, port, timeout = 10 * ONE_SECOND, elapse = 0 }) => {
const startTime = Date.now();
try {
await dial(port);
await dial(host, port);
debug('ping if started', { port });

@@ -46,7 +46,7 @@ return true;

return ensureStarted(port, timeout, spend);
return ensureStarted({ host, port, timeout, elapse: spend });
}
};
const ensureHealthy = async ({ port, minConsecutiveTime = 5 * ONE_SECOND }) => {
const ensureHealthy = async ({ host, port, minConsecutiveTime = 5 * ONE_SECOND }) => {
const checkInterval = 100; // ms

@@ -59,3 +59,3 @@ const minCheckTimes = Math.ceil(minConsecutiveTime / checkInterval);

debug('ping if healthy', { port });
await dial(port);
await dial(host, port);
await sleep(checkInterval);

@@ -65,3 +65,8 @@ }

module.exports = async ({ port, timeout = 10 * ONE_SECOND, minConsecutiveTime = 5 * ONE_SECOND }) => {
module.exports = async ({
host = '127.0.0.1',
port,
timeout = 10 * ONE_SECOND,
minConsecutiveTime = 5 * ONE_SECOND,
}) => {
debug('ensure endpoint healthy', { port, minConsecutiveTime });

@@ -74,5 +79,5 @@

return tryWithTimeout(async () => {
await ensureStarted(port, timeout - minConsecutiveTime);
await ensureHealthy({ port, minConsecutiveTime });
await ensureStarted({ host, port, timeout: timeout - minConsecutiveTime });
await ensureHealthy({ host, port, minConsecutiveTime });
}, timeout);
};

@@ -6,3 +6,3 @@ {

},
"version": "1.3.5",
"version": "1.3.6",
"description": "ArcBlock's JavaScript utility",

@@ -51,3 +51,3 @@ "main": "lib/index.js",

},
"gitHead": "46d5847cea5c9a3cf15c572346cf3a1626a3c001"
"gitHead": "71de63c9a036c1dad87339d8c2d955cfb58aff66"
}
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