Skip to content

Persist Last Used Lineage Context in Database Instead of Redis #7933

Open
@tsdk02

Description

@tsdk02

Currently, the last used lineage context (org_id, merchant_id, profile_id, role_id, tenant_id) is cached temporarily in Redis with a 7-day TTL.
While this improves user experience across sessions, it introduces problems like:

  • Redis is volatile — lineage context is lost if redis crashes
  • Users switching between v1/v2 deployments have inconsistent Redis prefixes, leading to stale context (this has been fixed)
  • Adds unnecessary dependency on Redis for critical authentication flow.

Objectives:

  • Move the lineage context storage from Redis to the database (preferably to the users table as a new column).
  • Ensure lineage context is persistently stored and updated in DB.

Tasks:

  • Add a new nullable last_used_lineage_context (JSON/JSONB) column to the users table.

  • Modify lineage context get and set helpers to use the DB instead of Redis.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions