Skip to content

Commit

Permalink
Better line wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
vdusek committed Jan 30, 2024
1 parent f4e8abe commit 9c89d3d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/crawlee/events/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,8 @@ async def listener_wrapper(event_data: EventData) -> None:

# If the listener is a coroutine function, just call it, otherwise, run it in a separate thread
# to avoid blocking the event loop
coroutine = (
listener(event_data) if iscoroutinefunction(listener) else asyncio.to_thread(listener, event_data)
)

listener_task = asyncio.create_task(coroutine, name=f'Task-{event.value}-{listener.__name__}')
coro = listener(event_data) if iscoroutinefunction(listener) else asyncio.to_thread(listener, event_data)
listener_task = asyncio.create_task(coro, name=f'Task-{event.value}-{listener.__name__}')
self._listener_tasks.add(listener_task)

try:
Expand Down

0 comments on commit 9c89d3d

Please sign in to comment.