fix(db): 🔧 Update pool size configurations.

This commit is contained in:
Nyeki.py
2024-10-17 19:28:08 -03:00
parent 177f55fb06
commit 013384c943
2 changed files with 22 additions and 5 deletions
+9 -2
View File
@@ -9,7 +9,7 @@ from discord import errors
from discord.ext import commands, tasks
from discord.utils import find
from tortoise import transactions
from tortoise import transactions, exceptions
import asyncpg.exceptions
@@ -648,7 +648,14 @@ class Calls(base.Cog):
channel = await utils.get_channel(message.channel)
call = await models.Call.get(id=channel.call_id).prefetch_related("channels")
try:
call = await models.Call.get(id=channel.call_id).prefetch_related(
"channels"
)
except exceptions.DoesNotExist:
await self.bot.redis.srem(constants.CHANNELS_ONCALL_SET, str(channel_id))
return
other_channel: models.Channel = find(
lambda c: c.id != channel_id, call.channels
+13 -3
View File
@@ -1,6 +1,7 @@
import os
from dotenv import load_dotenv
load_dotenv()
@@ -10,7 +11,18 @@ IS_DEBUG = os.environ.get("IS_DEBUG", "false") == "true"
TORTOISE_ORM = {
"connections": {
"default": f"postgres://payphone:payphone@{"localhost" if IS_DEBUG else "database"}/payphone",
"default": {
"engine": "tortoise.backends.asyncpg",
"credentials": {
"host": "localhost" if IS_DEBUG else "database",
"port": "5432",
"user": "payphone",
"password": "payphone",
"database": "payphone",
},
"minsize": 5,
"maxsize": 1000,
},
},
"apps": {
"models": {
@@ -18,8 +30,6 @@ TORTOISE_ORM = {
"default_connection": "default",
}
},
"minsize": 5,
"maxsize": 1000
}
SUGGESTIONS_CHANNEL_ID = int(os.getenv("SUGGESTIONS_CHANNEL_ID"))