aboutsummaryrefslogtreecommitdiffstats
path: root/botcore/_bot.py
diff options
context:
space:
mode:
Diffstat (limited to 'botcore/_bot.py')
-rw-r--r--botcore/_bot.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/botcore/_bot.py b/botcore/_bot.py
index e69b056d..69ccdc1c 100644
--- a/botcore/_bot.py
+++ b/botcore/_bot.py
@@ -222,6 +222,11 @@ class BotBase(commands.Bot):
)
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)
@@ -265,7 +270,7 @@ class BotBase(commands.Bot):
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: