I am new to Python, so please bear with me.
I am currently working on a project that acts as a middle ware which requires active user sessions to be periodically refreshed on the upstream system. I have no control over the upstream system other than to make some requests to it. One of the requirements is to allow users to be inactive on our system for a longer period of time than they are allowed to be inactive on the upstream system. In order to do this I need to periodically send a keep alive request to the upstream system. What I am trying to figure out is how this can be done.
The simplest way I can think of is to iterate through all active sessions, which are handled by pyramid_beaker, and send the keep alive request based on the upstream's session id stored in each of the sessions. If it is not possible to directly get a collection of all of the sessions is there a way to monitor the creation and destruction of sessions? Are either of those two options possible? If not, any pointers to another way this can be accomplished?