Explorar o código

fix exception error for async

AlpinDale hai 1 ano
pai
achega
c8c0b2f369
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      aphrodite/engine/async_aphrodite.py

+ 3 - 3
aphrodite/engine/async_aphrodite.py

@@ -394,8 +394,8 @@ class AsyncAphrodite:
 
             async for request_output in stream:
                 yield request_output
-        except Exception as e:
-            # If there is an exception, abort the request.
+        except (Exception, asyncio.CancelledError) as e:
+            # If there's an exception or co-routine is cancelled, abort the request.
             self._abort(request_id)
             raise e
 
@@ -457,4 +457,4 @@ class AsyncAphrodite:
                      log_stats=not engine_args.disable_log_stats,
                      max_log_len=engine_args.max_log_len,
                      start_engine_loop=start_engine_loop)
-        return engine
+        return engine