Debug GitLab note DM v6
This commit is contained in:
parent
edf3aada73
commit
4dad380a50
2 changed files with 18 additions and 14 deletions
|
|
@ -165,15 +165,20 @@ class FeatureSuggestionModal(disnake.ui.Modal):
|
|||
class BugReport(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
# disnake 2.12: `cog_load` async n'est pas appelé comme dans discord.py.
|
||||
# On lance le serveur aiohttp de façon différée.
|
||||
self.bot.loop.create_task(self._start_webhook_server())
|
||||
|
||||
async def _start_webhook_server(self):
|
||||
await self.bot.wait_until_ready()
|
||||
|
||||
async def cog_load(self):
|
||||
self.web_app = web.Application()
|
||||
self.web_app.router.add_post('/bot_event', self.handle_bot_event)
|
||||
self.runner = web.AppRunner(self.web_app)
|
||||
await self.runner.setup()
|
||||
|
||||
max_retries = 5
|
||||
retry_delay = 2
|
||||
max_retries = 10
|
||||
retry_delay = 5
|
||||
|
||||
for attempt in range(1, max_retries + 1):
|
||||
try:
|
||||
|
|
@ -184,7 +189,7 @@ class BugReport(commands.Cog):
|
|||
)
|
||||
return
|
||||
except OSError as e:
|
||||
if e.errno == 98: # Address already in use
|
||||
if getattr(e, 'errno', None) == 98: # Address already in use
|
||||
if attempt < max_retries:
|
||||
kuby_logger.warning(
|
||||
f"Port 5001 already in use, retrying in {retry_delay}s... ({attempt}/{max_retries})"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue