Skip to content

Commit

Permalink
fixing mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielePalaia committed Apr 8, 2024
1 parent c52ad08 commit 52dc572
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
16 changes: 15 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ mmh3 = "^4.0.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
requests = "^2.31.0"
types-requests = "^2.31.0.20240406"

[tool.black]
line-length = 110
Expand Down
9 changes: 6 additions & 3 deletions rstream/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,12 @@ async def reconnect_stream(self, stream: str, offset: Optional[int] = None) -> N
if stream == self._subscribers[subscriber_id].stream:
curr_subscriber = self._subscribers[subscriber_id]
curr_subscriber_id = subscriber_id
del self._subscribers[curr_subscriber_id]
if curr_subscriber_id is not None:
del self._subscribers[curr_subscriber_id]

if stream in self._clients:
await self._clients[stream].free_available_id(curr_subscriber.subscription_id)
if curr_subscriber is not None:
await self._clients[stream].free_available_id(curr_subscriber.subscription_id)
await self._clients[stream].close()
del self._clients[stream]

Expand Down Expand Up @@ -519,7 +521,8 @@ async def _maybe_clean_up_during_lost_connection(self, stream: str):

if stream in self._clients:
await self._clients[stream].remove_stream(stream)
await self._clients[stream].free_available_id(curr_subscriber.subscription_id)
if curr_subscriber is not None:
await self._clients[stream].free_available_id(curr_subscriber.subscription_id)
if await self._clients[stream].get_stream_count() == 0:
await self._clients[stream].close()
del self._clients[stream]

0 comments on commit 52dc572

Please sign in to comment.