From b1e69321801ca60420e17e01ce02d8952c40c56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=20=D0=9C=D0=B0=D1=81=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2?= Date: Wed, 26 Oct 2022 12:20:33 +0300 Subject: [PATCH] async fix done! --- Sources/pyOpenRPA/Orchestrator/ServerSettings.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py index 8eb8f5b4..316c8d30 100755 --- a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py +++ b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py @@ -155,7 +155,6 @@ async def pyOpenRPA_ServerData(inRequest: Request, inAuthTokenStr:str=Depends(Id # Generate hash lServerDataHashStr = str(hash(lServerDataDictJSONStr)) if lValueStr!=lServerDataHashStr and lServerDataHashStr!= "" and lServerDataHashStr!= None: # Case if Hash is not equal - print(f"lValueStr:{lValueStr}, lServerDataHashStr:{lServerDataHashStr}") lFlagDoGenerateBool = False else: # Case Hashes are equal await asyncio.sleep(inGSettings["Client"]["Session"]["ControlPanelRefreshIntervalSecFloat"]) @@ -330,7 +329,7 @@ def pyOpenRPA_ActivityListExecute(inRequest:Request, inAuthTokenStr:str = Depend # See docs in Agent (pyOpenRPA.Agent.O2A) @app.post(path="/orpa/agent/o2a",response_class=JSONResponse,tags=["Agent"]) -def pyOpenRPA_Agent_O2A(inRequest:Request, inAuthTokenStr:str = Depends(IdentifyAuthorize), inBodyDict = Body({})): +async def pyOpenRPA_Agent_O2A(inRequest:Request, inAuthTokenStr:str = Depends(IdentifyAuthorize), inBodyDict = Body({})): inGSettings = __Orchestrator__.GSettingsGet() lL = __Orchestrator__.OrchestratorLoggerGet() lConnectionLifetimeSecFloat = inGSettings["ServerDict"]["AgentConnectionLifetimeSecFloat"] # 300.0 # 5 min * 60 sec 300.0 @@ -398,9 +397,9 @@ def pyOpenRPA_Agent_O2A(inRequest:Request, inAuthTokenStr:str = Depends(Identify lThisAgentDict["ConnectionCountInt"] -= 1 # Connection go to be closed - decrement the connection count return lReturnActivityItemList else: # Nothing to send - sleep for the next iteration - time.sleep(lAgentLoopSleepSecFloat) + await asyncio.sleep(lAgentLoopSleepSecFloat) else: # no queue item - sleep for the next iteration - time.sleep(lAgentLoopSleepSecFloat) + await asyncio.sleep(lAgentLoopSleepSecFloat) except Exception as e: if lL: lL.exception("pyOpenRPA_Agent_O2A Exception!") lThisAgentDict["ConnectionCountInt"] -= 1 # Connection go to be closed - decrement the connection count