(TimeSlot): Add random dithers.

Add startup and close dither for ratelimiting.
This commit is contained in:
2022-05-16 20:04:59 +03:00
parent a33d882e3f
commit ec87cb7423

View File

@@ -2,6 +2,7 @@ from typing import List, Dict
import datetime
import discord
import asyncio
import random
from settings import GuildSettings
from utils.lib import tick, cross
@@ -364,6 +365,8 @@ class TimeSlot:
Start the accountability room slot.
Update the status message, and launch the DM reminder.
"""
dither = 15 * random.random()
await asyncio.sleep(dither)
if self.channel:
try:
await self.channel.edit(name="Scheduled Session Room")
@@ -408,6 +411,8 @@ class TimeSlot:
Delete the channel and update the status message to display a session summary.
Unloads the TimeSlot from cache.
"""
dither = 15 * random.random()
await asyncio.sleep(dither)
if self.channel:
try:
await self.channel.delete()