mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
fix(runtime): only accept one request at a time for exec action requests (#4589)
This commit is contained in:
@@ -159,11 +159,12 @@ class ActionExecutor:
|
||||
logger.debug('Bash init commands completed')
|
||||
|
||||
async def run_action(self, action) -> Observation:
|
||||
action_type = action.action
|
||||
logger.debug(f'Running action:\n{action}')
|
||||
observation = await getattr(self, action_type)(action)
|
||||
logger.debug(f'Action output:\n{observation}')
|
||||
return observation
|
||||
async with self.lock:
|
||||
action_type = action.action
|
||||
logger.debug(f'Running action:\n{action}')
|
||||
observation = await getattr(self, action_type)(action)
|
||||
logger.debug(f'Action output:\n{observation}')
|
||||
return observation
|
||||
|
||||
async def run(
|
||||
self, action: CmdRunAction
|
||||
@@ -372,13 +373,6 @@ if __name__ == '__main__':
|
||||
content={'message': 'Invalid request parameters', 'details': exc.errors()},
|
||||
)
|
||||
|
||||
@app.middleware('http')
|
||||
async def one_request_at_a_time(request: Request, call_next):
|
||||
assert client is not None
|
||||
async with client.lock:
|
||||
response = await call_next(request)
|
||||
return response
|
||||
|
||||
@app.middleware('http')
|
||||
async def authenticate_requests(request: Request, call_next):
|
||||
if request.url.path != '/alive' and request.url.path != '/server_info':
|
||||
|
||||
Reference in New Issue
Block a user