Compare commits

...
2 Commits
Author SHA1 Message Date
imcompiling eb6a8c7479 Feat: Add logging to tell when refresh happens.
build_latest / build (push) Successful in 44s
build_release / build (push) Successful in 22s
2025-05-27 23:33:19 -04:00
imcompiling 58b230afe6 Fix: Catch git error and refresh connection.
build_latest / build (push) Successful in 39s
build_release / build (push) Successful in 23s
I think that the git error is just happening from timing out. Trying to fix by
refreshing the connection when it happens.
2025-05-27 23:31:02 -04:00
@@ -6,10 +6,12 @@ from typing import TYPE_CHECKING
import uvicorn import uvicorn
from fastapi import FastAPI from fastapi import FastAPI
from git import Repo from git import Repo
from git.exc import GitCommandError
from nextcord.ext import commands from nextcord.ext import commands
from dakiny_bot.classes.gitea_webhook import GiteaWebhook from dakiny_bot.classes.gitea_webhook import GiteaWebhook
from dakiny_bot.DakinySettings import settings from dakiny_bot.DakinySettings import settings
from dakiny_bot.logger import dakiny_logger
from dakiny_bot.utils import REPO_DIR, edit_clan_council_info, update_clan_messages from dakiny_bot.utils import REPO_DIR, edit_clan_council_info, update_clan_messages
if TYPE_CHECKING: if TYPE_CHECKING:
@@ -55,7 +57,12 @@ class ClanMessages(commands.Cog, name="Clan Messages"):
template_updates = {file.split("/")[1] for file in modified_files if "message_templates" in file} template_updates = {file.split("/")[1] for file in modified_files if "message_templates" in file}
channel_updates = {file.split("/")[1] for file in modified_files if file.split("/")[1] not in template_updates} channel_updates = {file.split("/")[1] for file in modified_files if file.split("/")[1] not in template_updates}
try:
self.origin.pull() self.origin.pull()
except GitCommandError:
# I think the git connection timed out. Get a new one.
dakiny_logger.info("Refreshing git connection.")
self.repo_setup()
guild: nextcord.Guild = self.bot.get_guild(settings.params.guild_id) guild: nextcord.Guild = self.bot.get_guild(settings.params.guild_id)
await update_clan_messages(guild, channel_updates) await update_clan_messages(guild, channel_updates)