diff --git a/htagweb/server/__init__.py b/htagweb/server/__init__.py index de999f3..5f6c65d 100644 --- a/htagweb/server/__init__.py +++ b/htagweb/server/__init__.py @@ -254,7 +254,9 @@ async def killall(): running_hids:list=await bus.get(KEYAPPS) or [] if str(hid) in running_hids: log("Try to reuse process",hid) - assert await bus.publish(hid.event_interact,dict(cmd=CMD_REUSE,params=params)) + can = await bus.publish(hid.event_interact,dict(cmd=CMD_REUSE,params=params)) + if not can: + log("Can't answer the interaction REUSE !!!!") else: p=multiprocessing.Process(target=process, args=[],kwargs=params) p.start() diff --git a/htagweb/server/client.py b/htagweb/server/client.py index f676c69..11114a2 100644 --- a/htagweb/server/client.py +++ b/htagweb/server/client.py @@ -68,16 +68,19 @@ async def interact(self,**params) -> dict: """ return htag'actions or None (if process doesn't answer, after timeout) (dialog with process event) """ - # subscribe for response - await self.bus.subscribe( self.hid.event_interact_response ) - - # post the interaction - if await self.bus.publish( self.hid.event_interact, params ): - # wait actions - return await self._wait(self.hid.event_interact_response) or {} - else: - self.error(f"Can't publish {self.hid.event_interact} !!!") - + try: + # subscribe for response + await self.bus.subscribe( self.hid.event_interact_response ) + + # post the interaction + if await self.bus.publish( self.hid.event_interact, params ): + # wait actions + return await self._wait(self.hid.event_interact_response) or {} + else: + self.error(f"Can't publish {self.hid.event_interact} !!!") + except Exception as e: + self.error("***HrClient.interact error***",e) + return {} async def main():