Improve usability of utils.sleep_until

Fix issue where sleeping for an extended period on python 3.5
would cause an exception

Add sleep_until to API docs

Add result argument to sleep_until
This commit is contained in:
Josh B
2020-01-21 23:44:28 +10:00
committed by Rapptz
parent e21d49c980
commit d0a1956be9
3 changed files with 9 additions and 8 deletions

View File

@ -8,8 +8,6 @@ import logging
from discord.backoff import ExponentialBackoff
MAX_ASYNCIO_SECONDS = 3456000
log = logging.getLogger(__name__)
class Loop:
@ -360,10 +358,6 @@ class Loop:
"""
sleep = seconds + (minutes * 60.0) + (hours * 3600.0)
if sleep >= MAX_ASYNCIO_SECONDS:
fmt = 'Total number of seconds exceeds asyncio imposed limit of {0} seconds.'
raise ValueError(fmt.format(MAX_ASYNCIO_SECONDS))
if sleep < 0:
raise ValueError('Total number of seconds cannot be less than zero.')