Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove loop arguments from deprecated functions, ready for newer Pyth… #208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aiologstash/base_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
self._thread_id = threading.get_ident()

self._queue: asyncio.Queue[Union[logging.LogRecord, None]] = asyncio.Queue(
maxsize=qsize, loop=self._loop
maxsize=qsize
)

super().__init__(level=level)
Expand Down Expand Up @@ -113,7 +113,7 @@ async def _reconnect(self) -> None:
delay = self._random.gauss(
self._reconnect_delay, self._reconnect_jitter
)
await asyncio.sleep(delay, loop=self._loop)
await asyncio.sleep(delay)

def _serialize(self, record: logging.LogRecord) -> bytes:
for key, value in self._extra.items():
Expand Down
4 changes: 2 additions & 2 deletions aiologstash/tcp_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(

async def _connect(self) -> None:
self._reader, self._writer = await asyncio.open_connection(
self._host, self._port, loop=self._loop, **self._kwargs
self._host, self._port, **self._kwargs
)

async def _send(self, data: bytes) -> None:
Expand All @@ -47,6 +47,6 @@ async def _send(self, data: bytes) -> None:
async def _disconnect(self) -> None:
if self._writer is not None:
self._writer.close()
await asyncio.sleep(0, loop=self._loop) # wait for writer closing
await asyncio.sleep(0) # wait for writer closing
self._reader = None
self._writer = None
2 changes: 1 addition & 1 deletion tests/test_emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def coro(record):

m.side_effect = [OSError(), None]
log.info("Msg 1")
await asyncio.sleep(0.1, loop=loop)
await asyncio.sleep(0.1)
m_log.info.assert_has_calls(
[mock.call("Transport disconnected"), mock.call("Transport reconnected")]
)
Expand Down