From 864889ccabbabefc67310f563e345f5e4e84e6c6 Mon Sep 17 00:00:00 2001 From: Gilles Boccon-Gibod Date: Wed, 22 Mar 2023 17:26:32 -0700 Subject: [PATCH] rename .run to .spawn --- apps/bench.py | 6 +++--- bumble/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/bench.py b/apps/bench.py index bb30c330..19cdcfa9 100644 --- a/apps/bench.py +++ b/apps/bench.py @@ -323,7 +323,7 @@ class Receiver: self.expected_packet_index = packet_index + 1 if packet_flags & PACKET_FLAG_LAST: - AsyncRunner.run( + AsyncRunner.spawn( self.packet_io.send_packet( struct.pack('>bbI', PacketType.ACK, packet_flags, packet_index) ) @@ -423,7 +423,7 @@ class Ping: self.done.set() return - AsyncRunner.run(self.send_next_ping()) + AsyncRunner.spawn(self.send_next_ping()) # ----------------------------------------------------------------------------- @@ -472,7 +472,7 @@ class Pong: self.expected_packet_index = packet_index + 1 - AsyncRunner.run( + AsyncRunner.spawn( self.packet_io.send_packet( struct.pack('>bbI', PacketType.ACK, packet_flags, packet_index) ) diff --git a/bumble/utils.py b/bumble/utils.py index 880d3bbb..8a55684b 100644 --- a/bumble/utils.py +++ b/bumble/utils.py @@ -191,9 +191,9 @@ class AsyncRunner: return decorator @staticmethod - def run(coroutine): + def spawn(coroutine): """ - Create a task to run a coroutine in a "fire and forget" task. + Spawn a task to run a coroutine in a "fire and forget" mode. Using this method instead of just calling `asyncio.create_task(coroutine)` is necessary when you don't keep a reference to the task, because `asyncio`