trypear / pearai-server-issues-public

Repository dedicated to create issues for PearAI server.
6 stars 0 forks source link

[Small] Switch from TTL to Redis time entry #7

Open ItWasEnder opened 3 months ago

ItWasEnder commented 3 months ago

Currently, used_requests is stored in Redis with an expiration matching the user's subscription period_end. However, this approach lacks a method for tracking historical data unless we implemented heartbeats, which would be inefficient.

The proposed solution is to store the user's period_end in Redis. When this timestamp is <= now(), a historical entry should be added to a stats table in Supabase. Following this, the used_requests key in Redis would be reset to zero.

nang-dev commented 2 months ago

TRUE THAT