Fixed an issue in the FrameProcessor where only the current frame was checked for being an UninterruptibleFrame, not other frames in the queue.
This commit is contained in:
@@ -865,9 +865,17 @@ class FrameProcessor(BaseObject):
|
|||||||
async def _start_interruption(self):
|
async def _start_interruption(self):
|
||||||
"""Start handling an interruption by cancelling current tasks."""
|
"""Start handling an interruption by cancelling current tasks."""
|
||||||
try:
|
try:
|
||||||
if isinstance(self.__process_current_frame, UninterruptibleFrame):
|
current_is_uninterruptible = isinstance(
|
||||||
# We don't want to cancel UninterruptibleFrame, so we simply
|
self.__process_current_frame, UninterruptibleFrame
|
||||||
# cleanup the queue.
|
)
|
||||||
|
queue_has_uninterruptible = any(
|
||||||
|
isinstance(item[0], UninterruptibleFrame) for item in self.__process_queue._queue
|
||||||
|
)
|
||||||
|
if current_is_uninterruptible or queue_has_uninterruptible:
|
||||||
|
# We don't want to cancel an UninterruptibleFrame (either the
|
||||||
|
# one currently being processed or one waiting in the queue),
|
||||||
|
# so we simply cleanup the queue keeping only
|
||||||
|
# UninterruptibleFrames.
|
||||||
self.__reset_process_queue()
|
self.__reset_process_queue()
|
||||||
else:
|
else:
|
||||||
# Cancel and re-create the process task.
|
# Cancel and re-create the process task.
|
||||||
|
|||||||
Reference in New Issue
Block a user