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
|
||||
// store, subscribed to its own events at once, or a Redis store opened on
|
||||
// first use from redis.url under cooler's key prefix (nothing dials at
|
||||
// mount itself; a background warm-up opens it with a backoff, and a missing
|
||||
// URL is a 503 on stateful requests, logged).
|
||||
// store, subscribed to its own events at once, or a Redis store opened
|
||||
// from redis.url under cooler's key prefix by a background warm-up that
|
||||
// Mount starts (Mount itself never waits for it); a missing URL is a 503 on
|
||||
// stateful requests, logged.
|
||||
func (p *Pier) newStore() Store {
|
||||
if p.cfg.SessionStore != StoreRedis {
|
||||
ms := newMemoryStore()
|
||||
|
||||
@@ -228,9 +228,14 @@ func (s *redisStore) Subscribe(ctx context.Context, fn func(Event)) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// lazyStore opens the Redis store on first use, so nothing dials at mount
|
||||
// (route:list and tests never dial) and a missing redis.url is a 503 on the
|
||||
// first request, logged once, not a boot failure (cooler's rule).
|
||||
// lazyStore opens the Redis store without blocking Mount: Mount starts warm,
|
||||
// which dials in the background with a backoff (every failure logged as
|
||||
// "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 {
|
||||
open func(ctx context.Context) (Store, error)
|
||||
mu sync.Mutex
|
||||
|
||||
Reference in New Issue
Block a user