Mercurial > libervia-web
comparison libervia/server/session_iface.py @ 1506:ce879da7fcf7
server: fix `on_signal` callback
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 23 Mar 2023 17:50:54 +0100 |
parents | 409d10211b20 |
children | 106bae41f5c8 |
comparison
equal
deleted
inserted
replaced
1505:a169cbc315f0 | 1506:ce879da7fcf7 |
---|---|
35 FLAGS_KEY = "_flags" | 35 FLAGS_KEY = "_flags" |
36 NOTIFICATIONS_KEY = "_notifications" | 36 NOTIFICATIONS_KEY = "_notifications" |
37 MAX_CACHE_AFFILIATIONS = 100 # number of nodes to keep in cache | 37 MAX_CACHE_AFFILIATIONS = 100 # number of nodes to keep in cache |
38 | 38 |
39 | 39 |
40 class ISATSession(Interface): | 40 class IWebSession(Interface): |
41 profile = Attribute("Sat profile") | 41 profile = Attribute("Sat profile") |
42 jid = Attribute("JID associated with the profile") | 42 jid = Attribute("JID associated with the profile") |
43 uuid = Attribute("uuid associated with the profile session") | 43 uuid = Attribute("uuid associated with the profile session") |
44 identities = Attribute("Identities of XMPP entities") | 44 identities = Attribute("Identities of XMPP entities") |
45 | 45 |
46 | 46 |
47 @implementer(ISATSession) | 47 @implementer(IWebSession) |
48 class SATSession: | 48 class WebSession: |
49 profiles_map: Dict[Optional[str], List["SATSession"]] = {} | 49 profiles_map: Dict[Optional[str], List["WebSession"]] = {} |
50 | 50 |
51 def __init__(self, session): | 51 def __init__(self, session): |
52 self._profile = None | 52 self._profile = None |
53 self.jid = None | 53 self.jid = None |
54 self.started = time.time() | 54 self.started = time.time() |
134 f"Session for profile {profile} expired. {profile} has now {nb_session} " | 134 f"Session for profile {profile} expired. {profile} has now {nb_session} " |
135 f"session(s) active." | 135 f"session(s) active." |
136 ) | 136 ) |
137 | 137 |
138 @classmethod | 138 @classmethod |
139 def get_profile_sessions(cls, profile: str) -> List["SATSession"]: | 139 def get_profile_sessions(cls, profile: str) -> List["WebSession"]: |
140 return cls.profiles_map.get(profile, []) | 140 return cls.profiles_map.get(profile, []) |
141 | 141 |
142 def getPageData(self, page, key): | 142 def getPageData(self, page, key): |
143 """get session data for a page | 143 """get session data for a page |
144 | 144 |