Skip to content

Commit

Permalink
upd: handle user message
Browse files Browse the repository at this point in the history
  • Loading branch information
nerudxlf committed Oct 25, 2023
1 parent e0dff72 commit ea83e49
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rasa/core/channels/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def name(cls) -> Text:
return "rest"

def __init__(self):
self._background_task = set()
self._background_tasks = set()

@staticmethod
async def on_message_wrapper(
Expand Down Expand Up @@ -130,7 +130,7 @@ def _logger_task_status(self, task):
logger.error(f"{task.get_name()} Canceled Error!")
except asyncio.InvalidStateError as e:

Check failure on line 131 in rasa/core/channels/rest.py

View workflow job for this annotation

GitHub Actions / Code Quality

F841 [*] Local variable `e` is assigned to but never used
logger.error(f"{task.get_name()} Invalid State Error!")
return self._background_task.discard
return self._background_tasks.discard

def blueprint(
self, on_new_message: Callable[[UserMessage], Awaitable[None]]
Expand Down Expand Up @@ -180,9 +180,9 @@ async def receive(request: Request) -> Union[ResponseStream, HTTPResponse]:
input_channel=input_channel,
metadata=metadata,
)
task: asyncio.Task = asyncio.create_task(on_new_message(user_msg))
self._background_tasks.add(task)
task.add_done_callback(self._logger_task_status(task))
# using the example on line 109
task = asyncio.ensure_future(on_new_message(user_msg))
await task
except CancelledError:
structlogger.error(
"rest.message.received.timeout", text=copy.deepcopy(text)
Expand Down

0 comments on commit ea83e49

Please sign in to comment.