Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
If your app needs to wait for database connections, microservices or other stuff being available first, holla' has your back.
You can use it like this (assuming async/await in Node.js):
# ... inside an async function
await hollaback(
'web-host:80',
'arangodb-host:8529'
);
// Do other stuff after web and ArangoDB are ready
I wrote this because I use Docker Compose a lot.
Just though Docker thinks a service is ready, doesn't mean it is. That means dependencies can break.
I wanted a simple wait to await a promise before moving on.
Hollaback is it.
Without hipster ES6/7 stuff:
const hollaback = require('hollaback');
hollaback('host1:port', 'host2:port').then(function () {
// Our host names are available
});
For cool kids:
import hollaback from 'hollaback'
const hosts = [
'host1:port',
'host2:port'
];
(async function whenReady(){
await hollaback(...hosts);
// Our services are ready - go nuts...
}());
Pass either a list of host:port
strings or an array of them, and hollaback will try all of them before resolving the promise.
Under the hood, it uses Socket to probe a host/port.
By default, retries occur every 500ms until the port is available, and times out after 30 seconds.
You can override the defaults by passing an options object as the last param:
hollaback(hosts, {
retry: 500, // per connection retry (in ms)
timeout: 30 * 1000, // global timeout (rejects after this time, in ms)
socketTimeout: 1000, // per connection timeout (in ms)
})
Designed for Node 5 and above.
Run npm run test
FAQs
Resolves a Promise when host(s)/port(s) are ready
The npm package hollaback receives a total of 2 weekly downloads. As such, hollaback popularity was classified as not popular.
We found that hollaback demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.