fix(19.7): RA-IN-01 describe the Redis store's mount-time warm-up correctly
lazyStore's and newStore's doc comments no longer claim that nothing dials at mount: Mount starts a background warm-up that dials Redis with a backoff and logs each failed attempt. The comment records the decision to keep the warm-up for commands that mount pier without serving, such as route:list: it only dials and logs until the process exits.
This commit is contained in:
@@ -150,10 +150,10 @@ func Mount(host Host, app *backpack.App, plugins []party.Plugin) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newStore builds the session store mcp.sessions.store selects: the memory
|
// newStore builds the session store mcp.sessions.store selects: the memory
|
||||||
// store, subscribed to its own events at once, or a Redis store opened on
|
// store, subscribed to its own events at once, or a Redis store opened
|
||||||
// first use from redis.url under cooler's key prefix (nothing dials at
|
// from redis.url under cooler's key prefix by a background warm-up that
|
||||||
// mount itself; a background warm-up opens it with a backoff, and a missing
|
// Mount starts (Mount itself never waits for it); a missing URL is a 503 on
|
||||||
// URL is a 503 on stateful requests, logged).
|
// stateful requests, logged.
|
||||||
func (p *Pier) newStore() Store {
|
func (p *Pier) newStore() Store {
|
||||||
if p.cfg.SessionStore != StoreRedis {
|
if p.cfg.SessionStore != StoreRedis {
|
||||||
ms := newMemoryStore()
|
ms := newMemoryStore()
|
||||||
|
|||||||
@@ -228,9 +228,14 @@ func (s *redisStore) Subscribe(ctx context.Context, fn func(Event)) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// lazyStore opens the Redis store on first use, so nothing dials at mount
|
// lazyStore opens the Redis store without blocking Mount: Mount starts warm,
|
||||||
// (route:list and tests never dial) and a missing redis.url is a 503 on the
|
// which dials in the background with a backoff (every failure logged as
|
||||||
// first request, logged once, not a boot failure (cooler's rule).
|
// "session store not open yet, retrying"), and the first request of any
|
||||||
|
// path kicks an open too. A missing or unreachable Redis is therefore never
|
||||||
|
// a boot failure (cooler's rule): stateful requests answer 503 until the
|
||||||
|
// store opens, and the missing redis.url is logged once. A command that
|
||||||
|
// mounts pier without serving (route:list) also starts the warm-up; it only
|
||||||
|
// dials and logs until the process exits, so it is not skipped there.
|
||||||
type lazyStore struct {
|
type lazyStore struct {
|
||||||
open func(ctx context.Context) (Store, error)
|
open func(ctx context.Context) (Store, error)
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
|||||||
Reference in New Issue
Block a user