diff --git a/supriya/osc/asynchronous.py b/supriya/osc/asynchronous.py index 40a641f8f..839d59503 100644 --- a/supriya/osc/asynchronous.py +++ b/supriya/osc/asynchronous.py @@ -55,8 +55,7 @@ async def _disconnect(self, panicked: bool = False) -> None: async def _on_connect(self, *, boot_future: FutureLike[bool]) -> None: super()._on_connect(boot_future=self.boot_future) if self.on_connect_callback: - if asyncio.iscoroutine(result := self.on_connect_callback()): - await result + self.on_connect_callback() async def _on_disconnect( self, @@ -71,11 +70,9 @@ async def _on_disconnect( panicked=panicked, ) if panicked and self.on_panic_callback: - if asyncio.iscoroutine(result := self.on_panic_callback()): - await result + self.on_panic_callback() elif not panicked and self.on_disconnect_callback: - if asyncio.iscoroutine(result := self.on_disconnect_callback()): - await result + self.on_disconnect_callback() async def _on_healthcheck_passed(self, message: OscMessage) -> None: super()._on_healthcheck_passed(message) @@ -161,9 +158,7 @@ async def connect( lambda: self, remote_addr=(ip_address, port) ) if self.healthcheck and self.healthcheck.active: - self.healthcheck_task = asyncio.get_running_loop().create_task( - self._run_healthcheck() - ) + self.healthcheck_task = loop.create_task(self._run_healthcheck()) elif not self.healthcheck: await self._on_connect(boot_future=self.boot_future) diff --git a/supriya/scsynth.py b/supriya/scsynth.py index 7e77fd869..1c6a7ea58 100644 --- a/supriya/scsynth.py +++ b/supriya/scsynth.py @@ -496,8 +496,7 @@ async def boot(self, options: Options) -> None: await self.exit_future raise ServerCannotBoot(self.error_text) if self.on_boot_callback: - if asyncio.iscoroutine(result := self.on_boot_callback()): - loop.create_task(result) + self.on_boot_callback() def connection_made(self, transport) -> None: logger.info( @@ -534,11 +533,9 @@ def process_exited(self) -> None: except asyncio.exceptions.InvalidStateError: pass if was_quitting and self.on_quit_callback: - if asyncio.iscoroutine(result := self.on_quit_callback()): - asyncio.get_running_loop().create_task(result) + self.on_quit_callback() elif not was_quitting and self.on_panic_callback: - if asyncio.iscoroutine(result := self.on_panic_callback()): - asyncio.get_running_loop().create_task(result) + self.on_panic_callback() async def quit(self) -> None: if not self._quit():