Skip to content

octoprint.vendor.sockjs.tornado.sessioncontainer#

SessionContainer() #

Bases: object

Session container object.

If we will implement sessions with Tornado timeouts, for polling transports it will be nightmare - if load will be high, number of discarded timeouts will be huge and will be huge performance hit, as Tornado will have to clean them up all the time.

add(session) #

Add session to the container.

session Session object

expire(current_time = None) #

Expire any old entries

current_time Optional time to be used to clean up queue (can be used in unit tests)

get(session_id) #

Return session object or None if it is not available

session_id Session identifier

remove(session_id) #

Remove session object from the container

session_id Session identifier

SessionMixin(session_id = None, expiry = None) #

Bases: object

Represents one session object stored in the session container. Derive from this object to store additional data.

Constructor.

session_id Optional session id. If not provided, will generate new session id. expiry Expiration time. If not provided, will never expire.

is_alive() #

Check if session is still alive

on_delete(forced) #

Triggered when object was expired or deleted.

promote() #

Mark object as alive, so it won't be collected during next run of the garbage collector.