From 8e35812cd3c40b1286d1efac9116c9a34f05d787 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Mon, 3 Mar 2025 22:13:40 -0600 Subject: [PATCH] Increase concurrent db connections Decrease timeout on Scorebug buttons to reduce open connections --- cogs/gameplay.py | 2 +- in_game/gameplay_models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/gameplay.py b/cogs/gameplay.py index 82d8ec7..1ecbbbc 100644 --- a/cogs/gameplay.py +++ b/cogs/gameplay.py @@ -175,7 +175,7 @@ class Gameplay(commands.Cog): if this_play.game.roll_buttons and interaction.user.id in [this_play.game.away_team.gmid, this_play.game.home_team.gmid]: logger.info(f'Including scorebug buttons') - scorebug_buttons = ScorebugButtons(this_play, scorebug_embed) + scorebug_buttons = ScorebugButtons(this_play, scorebug_embed, timeout=5) if this_play.on_base_code == 0 and this_play.game.auto_roll and not this_play.batter.team.is_ai and not this_play.is_new_inning: logger.info(f'Rolling ab') diff --git a/in_game/gameplay_models.py b/in_game/gameplay_models.py index dc6fbb9..905c003 100644 --- a/in_game/gameplay_models.py +++ b/in_game/gameplay_models.py @@ -20,7 +20,7 @@ logger = logging.getLogger('discord_app') # connect_args = {"check_same_thread": False} # engine = create_engine(sqlite_url, echo=False, connect_args=connect_args) postgres_url = f'postgresql://{os.getenv('DB_USERNAME')}:{os.getenv('DB_PASSWORD')}@{os.getenv('DB_URL')}/{os.getenv('DB_NAME')}' -engine = create_engine(postgres_url) +engine = create_engine(postgres_url, pool_size=10, max_overflow=30) CACHE_LIMIT = 1209600 # in seconds SBA_COLOR = 'a6ce39' SBA_LOGO = 'https://sombaseball.ddns.net/static/images/sba-logo.png'