sleeper_api 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/CLAUDE.md +1 -1
- data/lib/sleeper_api/client.rb +3 -1
- data/lib/sleeper_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d50e1154f49ade4542daea9879637a05cacaa3d675718c83630a6800eb399c15
|
|
4
|
+
data.tar.gz: 3b8814cf8c167653d801dd3a2938f353a4dbe4cb2c219c4baa67cc365e925338
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd175da38e1c2e3d460de434744be76c92d6b536ca6a5c7031d90f968a5eb70ebda04424f9a2d888eaa1aefd0283649abcebfd667c7495358233d12a88a86be1
|
|
7
|
+
data.tar.gz: 502c7f1f64a96eb9e383390e0e42097ca7c8b9c2d24d14aade94e0b99ba8ac342e94b3238ddc7ea24564e75141d6fccc6df9b0c0c313ac29bcb86ee88a1bacfb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [1.10.1] - 2026-10-14
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- **A timed-out request is no longer retried behind the gem's back.** Net::HTTP
|
|
6
|
+
retries an idempotent GET once on its own (`max_retries` defaults to 1), and
|
|
7
|
+
the gem never switched that off, so every attempt cost two timeouts:
|
|
8
|
+
`retries = 0` made two requests and `retries = 3` made eight. Against a host
|
|
9
|
+
that accepts and never answers (measured 2026-10-14), `timeout = 10` gave up
|
|
10
|
+
after 20.0s and `timeout = 2.5` after 5.0s; now 10.0s and 2.5s. The default
|
|
11
|
+
configuration's worst case drops from ~243s to ~123s. `retries` is now the
|
|
12
|
+
only retry.
|
|
13
|
+
|
|
1
14
|
## [1.10.0] - 2026-10-14
|
|
2
15
|
|
|
3
16
|
### Changed
|
data/CLAUDE.md
CHANGED
|
@@ -28,7 +28,7 @@ Four layers, with a deliberate split between HTTP and modeling:
|
|
|
28
28
|
- **`SleeperApi`** (`lib/sleeper_api.rb`) — module-level config + memoized global `SleeperApi.client`. `Configuration` validates `timeout` (1–60, fractions allowed; 10–60 before 1.10.0) and `retries` (0–5), raising `SleeperApi::Error` outside those bounds.
|
|
29
29
|
- **`Client`** — the only thing that talks HTTP. `include HTTParty` with `base_uri "https://api.sleeper.app"` — **the bare host; the `/v1` lives in each path**. That is deliberate and load-bearing: not every Sleeper endpoint is versioned. `/schedule/{sport}/{season_type}/{season}` is served from the host root, and while `base_uri` carried the version that endpoint was unreachable at any path a caller could pass in. A new endpoint spells out where it lives; do not move the version back into `base_uri` to shorten the paths.
|
|
30
30
|
|
|
31
|
-
Every call funnels through the private `make_request`, which handles retry-on-timeout, logging, and converts non-2xx into `SleeperApi::Error` — and, since 1.5.1, **every connection failure too** (`CONNECTION_ERRORS`: `SocketError`, `SystemCallError`, `OpenSSL::SSL::SSLError`, `EOFError`), unretried, as `"Could not reach <path>: …"`. A consumer can rescue `SleeperApi::Error` alone and see every way a call fails. **That error quotes the path**, so the path prefix is part of a public string — v1.2.0 changed it from `"Failed to fetch /user/x: 404"` to `"Failed to fetch /v1/user/x: 404"`. `Client` also owns the 24-hour in-memory player cache.
|
|
31
|
+
Every call funnels through the private `make_request`, which handles retry-on-timeout (with Net::HTTP's own silent retry switched off, `max_retries: 0`, since 1.10.1 — it doubled every timeout), logging, and converts non-2xx into `SleeperApi::Error` — and, since 1.5.1, **every connection failure too** (`CONNECTION_ERRORS`: `SocketError`, `SystemCallError`, `OpenSSL::SSL::SSLError`, `EOFError`), unretried, as `"Could not reach <path>: …"`. A consumer can rescue `SleeperApi::Error` alone and see every way a call fails. **That error quotes the path**, so the path prefix is part of a public string — v1.2.0 changed it from `"Failed to fetch /user/x: 404"` to `"Failed to fetch /v1/user/x: 404"`. `Client` also owns the 24-hour in-memory player cache.
|
|
32
32
|
|
|
33
33
|
⚠️ **Never interpolate a value into a request path; build it with the private `path(*segments)`**, which escapes each segment. An unescaped one raised `URI::InvalidURIError` — not a `SleeperApi::Error`, so it escaped every rescue — or walked out of the endpoint: `../../league/123` as a username requested `/league/123` (G.6, v1.6.0). An unknown user is `200` with a `null` body, which `get_user` turns into `SleeperApi::UserNotFound`.
|
|
34
34
|
|
data/lib/sleeper_api/client.rb
CHANGED
|
@@ -538,7 +538,9 @@ module SleeperApi
|
|
|
538
538
|
# @raise [SleeperApi::Error] On HTTP errors or timeouts
|
|
539
539
|
def make_request(path, host: nil, not_found: nil)
|
|
540
540
|
named = host ? "#{host}#{path}" : path
|
|
541
|
-
|
|
541
|
+
# max_retries: 0, or Net::HTTP retries a timed-out GET once on its own and
|
|
542
|
+
# every attempt below costs two timeouts.
|
|
543
|
+
options = { timeout: @config.timeout, max_retries: 0 }
|
|
542
544
|
options[:base_uri] = host if host
|
|
543
545
|
|
|
544
546
|
@config.logger&.info("Making request to #{host || self.class.base_uri}#{path}")
|
data/lib/sleeper_api/version.rb
CHANGED