Skip to content

Commit

Permalink
docs(timeout): TaskCancelledError never gets executed on Cooperative (
Browse files Browse the repository at this point in the history
#98)

`TimeoutStrategy.Cooperative` throws the delegate exception, so it won't fire `TaskCancelledError` as shown in example. Switching to `TimeoutStrategy.Aggressive` is required to the example to work as expected.
  • Loading branch information
nagaozen authored Jul 25, 2024
1 parent 8e580da commit 975fc44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ Creates a timeout policy. The duration specifies how long to wait before timing
```js
import { TimeoutStrategy, timeout, TaskCancelledError } from 'cockatiel';

const timeout = timeout(2000, TimeoutStrategy.Cooperative);
const timeout = timeout(2000, TimeoutStrategy.Aggressive);

export async function handleRequest() {
try {
Expand Down

0 comments on commit 975fc44

Please sign in to comment.