fix(surf): close the rate-limit store a router created (quick-261118-lbt)
- MemoryStore.Close stops the sweep goroutine; Attempt keeps working - Router.Close runs what the router owns (the fallback MemoryStore of BuildRouter), never a store published on the app - BuildRouter closes the router on every error return - serve closes its router and installCooler's fallback store on exit; route:list closes its router - README and rate-limiting docs describe the ownership
This commit is contained in:
@@ -58,7 +58,7 @@ Keys are `<prefix>rl:<key>`. The prefix is `cache.prefix`, or by default `app.na
|
||||
|
||||
When Redis does not answer, each attempt waits at most `cooler.AttemptTimeout` (500 ms) and then counts in a per-instance `surf.MemoryStore`, as if the memory store were selected, until Redis answers again. A warning is logged at most once a minute. Redis being down at start-up is a warning too, not a failed start; a missing or malformed `redis.url` fails the start with an error that names the key and never shows the URL.
|
||||
|
||||
Only `serve` connects to Redis. `route:list` builds the router with the memory store, and so does `surf.Assemble` in tests, so neither needs a running Redis.
|
||||
Only `serve` connects to Redis. `route:list` builds the router with the memory store, and so does `surf.Assemble` in tests, so neither needs a running Redis. That memory store is the router's own: `surf.Router.Close` stops its background sweep, so a test that builds many routers closes them and does not pile up sweep goroutines. A store published on the app (such as cooler's Redis store) is never closed by the router; `serve` closes the per-instance fallback store it created on shutdown.
|
||||
|
||||
## Client IP and trusted proxies
|
||||
|
||||
|
||||
Reference in New Issue
Block a user