npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mimik/cluster

v5.0.4

Published

cluster management for mimik microservices

Downloads

191

Readme

cluster

Example

import cluster from '@mimik/cluster';

 The following environment variables are set:

| Env variable name | Description | Default | Comments |
| ----------------- | ----------- | ------- | -------- |
| REGISTRATION_STATUS | Status of the registration with mIT |  |  |
| CLUSTER_STATUS_SERVERS | Number of servers in the cluster |  |  |
| CLUSTER_STATUS_UPDATED_AT | Timestamp of the last cluster status update |  |  |
| CLUSTER_STATUS_LEASE_TIME | Lease time interval |  |  |

cluster~rpCluster(options) ⇒ Promise

The response is an object with the following structure:

{
  "data": [ 'array of all successful response payloads' ],
  "results": [
    {
      "result": (response from [rp-retry](http://lib.mimik360.com:4873/request-retry)),
      "server": (cluster node that produced the result)
    }
  ],
  "failures": [
    {
      "error": (error thrown for a request to a cluster node),
      "server": (cluster node that produced the error)
    }
  ]
}

Kind: inner method of cluster
Category: async
Requires: module:@mimik/sumologic-winston-logger, module:@mimik/oauth-helper, module:@mimik/response-helper
Fulfil: object - Aggregated response of the request.

| Param | Type | Description | | --- | --- | --- | | options | object | Options for the request (similar to axios options). The only difference is the URL: it must NOT include the base URL, because the cluster provides it. |

cluster~register(correlationId, retry) ⇒ Promise

Register a server with mIT.

Kind: inner method of cluster
Returns: Promise - .
Category: async
Requires: module:@mimik/sumologic-winston-logger, module:@mimik/oauth-helper, module:@mimik/address-helper
Fulfil: null or the response from rpCluster

Registration with mIT is retried at the interval defined by REGISTRATION_RETRY. When registration completes, a lease call is made to mIT at a regular interval. The lease interval is defined by mIT; if unspecified, it defaults to 2 hours. When cluster management is enabled, a concurrent registration is executed after approximately 60 seconds to guarantee cluster integrity.

| Param | Type | Description | | --- | --- | --- | | correlationId | UUID.<string> | Correlation ID to associate with the request. | | retry | boolean | Flag used when concurrent registration occurs. |

cluster~unRegister(correlationId) ⇒ Promise

The returned object is:

{
  nbServers: "number of servers in the cluster",
  serverId: "server ID",
  errors: "optional array of errors that occurred while unregistering"
}

Kind: inner method of cluster
Returns: Promise - .
Category: async
Requires: module:@mimik/sumologic-winston-logger, module:@mimik/oauth-helper
Fulfil: An object containing the number of servers, the serverId, and any errors (if present).

| Param | Type | Description | | --- | --- | --- | | correlationId | UUID.<string> | Correlation ID to associate with the request. |

cluster~createItResource(con, req, res)

Create IT resource endpoint.

Kind: inner method of cluster
Category: sync
Requires: module:@mimik/swagger-helper, module:@mimik/response-helper, module:@mimik/sumologic-winston-logger

| Param | Type | Description | | --- | --- | --- | | con | object | Request context (from OpenAPI). | | req | object | The HTTP request. | | res | object | The HTTP response. |

cluster~deleteServer(con, req, res)

Delete server endpoint.

Kind: inner method of cluster
Category: sync
Requires: module:@mimik/swagger-helper, module:@mimik/response-helper

| Param | Type | Description | | --- | --- | --- | | con | object | Request context (from OpenAPI). | | req | object | The HTTP request. | | res | object | The HTTP response. |