Skip to content

Commit

Permalink
📝 add doc about limiter abort
Browse files Browse the repository at this point in the history
  • Loading branch information
Harvey Woo authored and harvey-woo committed Dec 10, 2023
1 parent ce2f9a2 commit b5be82a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ const limiter = pool.limit({
minDuration: 1000,
});

// limiter has a `abort` method that can abort the current consumption function, the return of execution will throw an error
limiter.abort(new DOMException('AbortError'));

```

### pLimit / Pool.limit / limit
Expand Down
3 changes: 3 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ const limiter = pool.limit({
minDuration: 1000,
});

// 资源限制器提供了一个 `abort` 方法,可以中断当前的消费函数,使执行返回会抛出错误
limiter.abort(new DOMException('AbortError'));

```

### pLimit / Pool.limit
Expand Down

0 comments on commit b5be82a

Please sign in to comment.