Skip to content

Commit

Permalink
fix tag_update
Browse files Browse the repository at this point in the history
  • Loading branch information
manatlan committed Oct 15, 2023
1 parent 5f15a96 commit b2ddd39
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions htagweb/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import asyncio,traceback,os
import signal,platform
import redys
import redys.v2
import os,sys,importlib,inspect
import time
Expand Down Expand Up @@ -143,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
Expand Down Expand Up @@ -209,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 )
Expand Down Expand Up @@ -283,6 +291,10 @@ async def session(self,hid:Hid) -> dict:
FactorySession=importFactorySession(sesprovidername)
return FactorySession(hid.uid)

async def info(self,hid:Hid) -> dict:
""" get infos from hid"""
return await self._bus.get(hid.KEY_SYSINFO)


##################################################################################
async def startServer():
Expand Down

0 comments on commit b2ddd39

Please sign in to comment.