KamoCRM

Read *** from master after session refresh to avoid replica lag

Fixkamo-internal
Shipped
11 மே, 2026 அன்று 6:23 PM UTC
Author
kamo
Commit
a274da5

The previous fix had /api/user-info call /api/security/session/refresh before reading Redis, but the read went through readKsemJsonFromRedisWithRetry which uses getRedisReadClient() — a read replica. The refresh write hits the Redis master, so on a freshly-replicated key there is a replication-lag window where the replica still serves the stale JSON. The shared retry reader only re-tries when the key is missing or empty, not when it's stale, so it returned old rights every time and pages like /settings/account kept redirecting child-org owners off Apps & Features. When the refresh succeeds, read straight from the write client (the same master that just received the write) so we always see our own write. Fall back to the shared retry reader only when no refresh ran — the replica path is cheaper and the existing retry behaviour handles missing-key races on brand-new sessions.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing