aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2022-04-02 22:48:26 +0100
committerGravatar GitHub <[email protected]>2022-04-02 22:48:26 +0100
commite42e568257f4f1347a45754a9db99942ad5a7173 (patch)
treeb3e26d11ef03884205bd282def8323bc7927fac9
parentMerge pull request #50 from python-discord/update-all-deps (diff)
parentMove the creation of BotBase's AsyncResolver to async setup (diff)
Merge pull request #54 from python-discord/move-creation-of-AsyncResolverv5.0.1
Move the creation of BotBase's AsyncResolver to async setup
-rw-r--r--botcore/_bot.py15
-rw-r--r--pyproject.toml2
2 files changed, 10 insertions, 7 deletions
diff --git a/botcore/_bot.py b/botcore/_bot.py
index a43bb344..6486670d 100644
--- a/botcore/_bot.py
+++ b/botcore/_bot.py
@@ -69,12 +69,8 @@ class BotBase(commands.Bot):
self.api_client: Optional[APIClient] = None
- self._resolver = aiohttp.AsyncResolver()
- self._connector = aiohttp.TCPConnector(
- resolver=self._resolver,
- family=socket.AF_INET,
- )
- self.http.connector = self._connector
+ self._resolver: Optional[aiohttp.AsyncResolver] = None
+ self._connector: Optional[aiohttp.TCPConnector] = None
self.statsd_url: Optional[str] = None
self._statsd_timerhandle: Optional[asyncio.TimerHandle] = None
@@ -213,6 +209,13 @@ class BotBase(commands.Bot):
"""
loop = asyncio.get_running_loop()
+ self._resolver = aiohttp.AsyncResolver()
+ self._connector = aiohttp.TCPConnector(
+ resolver=self._resolver,
+ family=socket.AF_INET,
+ )
+ self.http.connector = self._connector
+
self._connect_statsd(self.statsd_url, loop)
self.stats = AsyncStatsClient(loop, "127.0.0.1")
await self.stats.create_socket()
diff --git a/pyproject.toml b/pyproject.toml
index ad5aa85c..97bf8ab3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bot-core"
-version = "5.0.0"
+version = "5.0.1"
description = "Bot-Core provides the core functionality and utilities for the bots of the Python Discord community."
authors = ["Python Discord <[email protected]>"]
license = "MIT"