From b99b8cf983d55d3e6d74a63b7b09a66b34e4d935 Mon Sep 17 00:00:00 2001 From: manatlan Date: Sun, 15 Oct 2023 11:34:53 +0200 Subject: [PATCH] feat: ServerClient.info() returns more info --- htagweb/server/__init__.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/htagweb/server/__init__.py b/htagweb/server/__init__.py index 306d841..fb70c50 100644 --- a/htagweb/server/__init__.py +++ b/htagweb/server/__init__.py @@ -142,8 +142,17 @@ async def update(actions): log("tag.update not possible (http only)") #====================================== - await registerHrProcess(bus,hid,FactorySession.__name__,pid) time_activity = time.monotonic() + + await registerHrProcess(bus,hid,dict( + sesprovider=FactorySession.__name__, + pid=pid, + timeout_inactivity=timeout_inactivity, + http_only = not useUpdate, + timestamp = time_activity, + ) + ) + try: # publish the 1st rendering @@ -208,12 +217,12 @@ async def update(actions): asyncio.run( loop() ) log("end") -async def registerHrProcess(bus,hid:Hid,sesprovider:str,pid:int): +async def registerHrProcess(bus,hid:Hid,info:dict): # register hid in redys "apps" await bus.sadd(KEYAPPS,str(hid)) # save sesprovider for this hid - await bus.set(hid.KEY_SYSINFO, dict(sesprovider=sesprovider,pid=pid)) + await bus.set(hid.KEY_SYSINFO, info) # subscribe for interaction await bus.subscribe( hid.EVENT_INTERACT ) @@ -283,11 +292,8 @@ async def session(self,hid:Hid) -> dict: return FactorySession(hid.uid) async def info(self,hid:Hid) -> dict: - """ get info from hid""" - sesinfo=await self._bus.get(hid.KEY_SYSINFO) - return dict( - pid=sesinfo["pid"], - ) + """ get infos from hid""" + return await self._bus.get(hid.KEY_SYSINFO) ##################################################################################