Kaynağa Gözat

fix exception error for async

AlpinDale 1 yıl önce
ebeveyn
işleme
c8c0b2f369
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  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