Skip to content

Commit

Permalink
Add ProcessCtx usage in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jarri-abidi committed Jan 26, 2021
1 parent 0c8d07a commit 686905c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ if err == tunny.ErrJobTimedOut {
}
```

You can also use the context from the request (or any other context) to handle timeouts and deadlines. Simply replace the `Process` call to the following:

``` go
result, err := pool.ProcessCtx(r.Context(), input)
if err == context.DeadlineExceeded {
http.Error(w, "Request timed out", http.StatusRequestTimeout)
}
```

## Changing Pool Size

The size of a Tunny pool can be changed at any time with `SetSize(int)`:
Expand Down

0 comments on commit 686905c

Please sign in to comment.