Browse Source

[tasks] Fix initial loop execution running prematurely

pull/7494/head
Sebastian Law 3 years ago
committed by GitHub
parent
commit
19ad64adda
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      discord/ext/tasks/__init__.py

3
discord/ext/tasks/__init__.py

@ -584,12 +584,13 @@ class Loop(Generic[LF]):
time_now = (
now if now is not MISSING else datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0)
).timetz()
idx = -1
for idx, time in enumerate(self._time):
if time >= time_now:
self._time_index = idx
break
else:
self._time_index = 0
self._time_index = idx + 1
def _get_time_parameter(
self,

Loading…
Cancel
Save