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