Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about Downloader when multithreading #250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ If the `downloader` keyword argument is provided, it must be a `Downloader`
object. Resources and connections will be shared between downloads performed by
the same `Downloader` and cleaned up automatically when the object is garbage
collected or there have been no downloads performed with it for a grace period.
See `Downloader` for more info about configuration and usage.
Note that when multithreading it may be beneficial to use task-local `Downloader`
objects when running concurrent tasks. See `Downloader` for more info about configuration
and usage.

If the `headers` keyword argument is provided, it must be a vector or dictionary
whose elements are all pairs of strings. These pairs are passed as headers when
Expand Down Expand Up @@ -134,11 +136,11 @@ with getting a response at all, then a `RequestError` is thrown or returned.
```jl
default_downloader!(
downloader = <none>
)
)
```
- `downloader :: Downloader`

Set the default `Downloader`. If no argument is provided, resets the default downloader
Set the default `Downloader`. If no argument is provided, resets the default downloader
so that a fresh one is created the next time the default downloader is needed.

### Response
Expand Down Expand Up @@ -207,6 +209,8 @@ garbage collected, whichever comes first. If the grace period is set to zero,
all resources will be cleaned up immediately as soon as there are no more
ongoing downloads in progress. If the grace period is set to `Inf` then
resources are not cleaned up until `Downloader` is garbage collected.
Note that when multithreading it may be beneficial to use task-local `Downloader`
objects when running concurrent tasks.


## Mutual TLS using Downloads
Expand Down
6 changes: 5 additions & 1 deletion src/Downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ garbage collected, whichever comes first. If the grace period is set to zero,
all resources will be cleaned up immediately as soon as there are no more
ongoing downloads in progress. If the grace period is set to `Inf` then
resources are not cleaned up until `Downloader` is garbage collected.
Note that when multithreading it may be beneficial to use task-local `Downloader`
objects when running concurrent tasks.
"""
mutable struct Downloader
multi::Multi
Expand Down Expand Up @@ -200,7 +202,9 @@ If the `downloader` keyword argument is provided, it must be a `Downloader`
object. Resources and connections will be shared between downloads performed by
the same `Downloader` and cleaned up automatically when the object is garbage
collected or there have been no downloads performed with it for a grace period.
See `Downloader` for more info about configuration and usage.
Note that when multithreading it may be beneficial to use task-local `Downloader`
objects when running concurrent tasks. See `Downloader` for more info about
configuration and usage.

If the `headers` keyword argument is provided, it must be a vector or dictionary
whose elements are all pairs of strings. These pairs are passed as headers when
Expand Down
Loading