Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 5.0.3 18th April 2022
- Fix: Reconnect to redis session on setup if it is closed.

## 5.0.2 5th April 2022
- Fix: Create a dummy `AsyncstatsdClient` before connecting to real url, in case a connection cannot be made on init.
- Fix: Move the creation of the `asyncio.Event`, `BotBase._guild_available` to within the setup hook, to avoid a deprecation notice.
Expand Down
7 changes: 6 additions & 1 deletion botcore/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ async def setup_hook(self) -> None:
)
self.http.connector = self._connector

if getattr(self, "redis_session", False) and self.redis_session.closed:
# If the RedisSession was somehow closed, we try to reconnect it
# here. Normally, this shouldn't happen.
await self.redis_session.connect()

# Create dummy stats client first, in case `statsd_url` is unreachable within `_connect_statsd()`
self.stats = AsyncStatsClient(loop, "127.0.0.1")
self._connect_statsd(self.statsd_url, loop)
Expand Down Expand Up @@ -265,7 +270,7 @@ async def close(self) -> None:
if self.stats._transport:
self.stats._transport.close()

if getattr(self.redis_session, None):
if getattr(self, "redis_session", False):
await self.redis_session.close()

if self._statsd_timerhandle:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bot-core"
version = "5.0.2"
version = "5.0.3"
description = "Bot-Core provides the core functionality and utilities for the bots of the Python Discord community."
authors = ["Python Discord <info@pythondiscord.com>"]
license = "MIT"
Expand Down