Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/v7-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- run: echo "//wombat-dressing-room.appspot.com/:_authToken=$AUTH_TOKEN" >> .npmrc
env:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
- run: npm publish --provenance --access=public --no-git-tag-version --tag v-7
- run: npm publish --provenance --access=public --no-git-tag-version --tag legacy
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gives sensible defaults.
## Install

```bash
npm install zx@7 # or npm install zx@v-7
npm install zx
```
**Requirement**: Node.js >= 16.0.0

Expand Down
12 changes: 7 additions & 5 deletions src/goods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ export async function retry<T>(
throw lastErr
}

export function* expBackoff(max: Duration = '60s', rand: Duration = '100ms') {
export function* expBackoff(
max: Duration = '60s',
delay: Duration = '100ms'
): Generator<number, void, unknown> {
const maxMs = parseDuration(max)
const randMs = parseDuration(rand)
let n = 1
const randMs = parseDuration(delay)
let n = 0
while (true) {
const ms = Math.floor(Math.random() * randMs)
yield Math.min(2 ** n++, maxMs) + ms
yield Math.min(randMs * 2 ** n++, maxMs)
}
}

Expand Down