# `NervesHubLink.Downloader.RetryConfig`
[🔗](https://github.com/nerves-hub/nerves_hub_link/blob/v2.12.0/lib/nerves_hub_link/downloader/retry_config.ex#L7)

Download retry configuration.

This module provides configuration for how the `Downloader` process will
handle disconnects, errors, and timeouts.

## Options

  * `:max_disconnects` (`t:non_neg_integer/0`) - Maximum number of disconnects.
  After this limit is reached the download will be stopped and will no longer be retried. The default value is `10`.

* `:idle_timeout` (`t:non_neg_integer/0`) - Time (in milliseconds) between chunks of data received that once elapsed will trigger a retry.
  This event counts towards the `max_disconnects` counter. The default value is `60000`.

* `:max_timeout` (`t:non_neg_integer/0`) - Maximum time (in milliseconds) that a download can exist for.
  After this amount of time has elapsed, the download is canceled and the download process will crash.
  The default value is 24 hours. The default value is `86400000`.

* `:time_between_retries` (`t:non_neg_integer/0`) - Time (in milliseconds) to wait before attempting to retry a download. The default value is `15000`.

* `:worst_case_download_speed` (`t:non_neg_integer/0`) - Worst case download speed specified in bytes per second.
  This is used to calculate the "worst case" ("sensible") download timeout and is
  intended to fail faster than waiting for `max_timeout` to elapse.
  For reference, LTE Cat M1 modems sometimes top out at 32 kbps (30 kbps for some slack). The default value is `30000`.

# `t`

```elixir
@type t() :: %NervesHubLink.Downloader.RetryConfig{
  idle_timeout: non_neg_integer(),
  max_disconnects: non_neg_integer(),
  max_timeout: non_neg_integer(),
  time_between_retries: non_neg_integer(),
  worst_case_download_speed: non_neg_integer()
}
```

# `validate`

```elixir
@spec validate(Keyword.t()) :: t()
```

Validates a proposed configuration, returning the default configuration on error

---

*Consult [api-reference.md](api-reference.md) for complete listing*
