Currently we have flows.flowsession.timeout_on and wait_expires_on to track when we need to timeout or expire a session wait. Two issues:
There's no immediate state change to say that we've queued the timeout/expire task and the actual change to the session db row might take a while to happen. So we have to use markers in Redis to prevent dupe handling by the task and we have the inefficiency of refetching sessions until the tasks complete.
We potentially want to stop writing sessions to the database.
Maybe we add a new model which just holds a timed event for a session:
Session ID
Contact ID
EventType (timeout vs expiration)
Time
A cron job processes those, queues them appropriately and deletes the row when done. No need to mark anything in Redis.
Reminder to self: it's courier that actually sets flows.flowsession.timeout_on when a message is actually sent, so it would have to be courier that creates the new thing too.
Currently we have
flows.flowsession.timeout_on
andwait_expires_on
to track when we need to timeout or expire a session wait. Two issues:Maybe we add a new model which just holds a timed event for a session:
A cron job processes those, queues them appropriately and deletes the row when done. No need to mark anything in Redis.