# stagger

> Execute a stack with a given 'request-per-seconds' and 'max-requests' rate.

Latest version **1.0.0** (published 2013-11-28) · BSD license · 0 weekly downloads

## Install

```sh
npm install stagger
pnpm add stagger
yarn add stagger
bun add stagger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2013-11-28 |
| First published | 2013-05-24 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Ubilabs |
| Maintainers | aemkei |
| Keywords | batch, stack, request, rps, async |

## Links

- npm: https://www.npmjs.com/package/stagger
- Repository: https://github.com/ubilabs/node-stagger
- npm.io page: https://npm.io/package/stagger

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2013-11-28
- 0.1.0 — 2013-05-24

## README

# node-stagger

Execute a stack with a given 'request-per-seconds' and 'max-requests' rate.

[![Build Status](https://travis-ci.org/ubilabs/node-stagger.png)](https://travis-ci.org/ubilabs/node-stagger)
### Install

```sh
npm install stagger
```

### Usage

```js
var stagger = new Stagger(options);
stagger.push(methods);
stagger.start();
stagger.on("progress", handleResponse);
stagger.on("finish", handleDone);
```

### Options

* `requestsPerSecond` - Number of requests per seconds. Default: 10
* `maxRequests` - Maximum open requests. Default: 20

### Events

"progress" Event:

* `index` - initial stack index
* `pending` - number of pending calls
* `total` - total call count
* `current` - current batch size
* `percent` - current percentage
* `eta` - estimated total duration
* `callback` - original callback
* `value` - returned value
* `duration` - response time

"complete" Event:

* `total` - total call count
* `duration` - total duration

### Example

```js
var Stagger = require("../lib/stagger"),
  stagger = new Stagger();

for (var i=0; i<100; i++){
  stagger.push(callback);
}

stagger.on("progress", function(event){
  console.log(event.value);
});

stagger.on("finish", function(event){
  console.log("finish", event.duration);
});

stagger.start();
```

### Author

Martin Kleppe - kleppe@ubilabs.net

---
_Source: https://npm.io/package/stagger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
