M aio_mpv_ipc/__init__.py => aio_mpv_ipc/__init__.py +1 -1
@@ 10,7 10,7 @@ from .exceptions import (
MpvStartException,
)
-__version__ = "0.0.1a6"
+__version__ = "0.0.1a7"
__all__ = (
"MpvClient",
"start_mpv",
M aio_mpv_ipc/_client.py => aio_mpv_ipc/_client.py +10 -4
@@ 141,6 141,11 @@ class MpvClient:
pass
self._poll_task = None
+ if self._futures:
+ logger.debug("Cancelling pending futures")
+ for fut in self._futures.values():
+ fut.cancel()
+
async def _poll(self):
while not self._reader.at_eof():
data = await self._reader.readline()
@@ 166,10 171,11 @@ class MpvClient:
request_id = response.get("request_id")
if request_id:
fut = self._futures.pop(request_id)
- if is_error:
- fut.set_exception(IPCException(status, response))
- else:
- fut.set_result(response.get("data"))
+ if not fut.cancelled():
+ if is_error:
+ fut.set_exception(IPCException(status, response))
+ else:
+ fut.set_result(response.get("data"))
logger.debug("EOF received, stopping polling")
M pyproject.toml => pyproject.toml +1 -1
@@ 1,6 1,6 @@
[tool.poetry]
name = "aio-mpv-ipc"
-version = "0.0.1a6"
+version = "0.0.1a7"
description = "Asynchronous mpv JSON IPC client"
authors = ["Naglis Jonaitis <hello@naglis.me>"]
license = "Apache-2.0"