Commit Graph
19 Commits
Author SHA1 Message Date
Sebastian LawandGitHub 04535e4e1d [tasks] use None instead of MISSING for internal attributes 2022-03-10 23:12:22 -05:00
Sebastian LawandGitHub 483ffeacd4 Inject state into PartialEmoji in Activity 2022-03-10 20:56:20 -05:00
caa816a636 Add more tests for utils
Co-authored-by: Nadir Chowdhury <chowdhurynadir0@outlook.com>
2022-03-07 17:10:28 -05:00
Sebastian LawandGitHub 3c78b03aa3 Test regressions for the task extension
* tests for testing regression of 19ad64a
* fix edge case for test running within 3 minutes of the start of the hour
2022-03-07 17:09:30 -05:00
Sebastian LawandGitHub 87415ab5a7 Fix modal docs code block warning 2022-03-06 19:16:23 -05:00
Sebastian LawandGitHub 1dccd70b05 Fix refs to abc.Connectable.connect 2022-03-06 18:46:10 -05:00
b77cf500a2 Make description parameter of Guild.create_sticker non-Optional
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2022-03-06 18:43:42 -05:00
Sebastian LawandGitHub 4a5057551a Fix typo in circular comment 2022-03-05 22:59:48 -05:00
Sebastian LawandGitHub 5439a67056 [tasks] Fix sleep handling behaviour depending on interval type
Relative time intervals can be thought of as:

  for _ in range(count):
    await body()
    await asyncio.sleep(interval)

While explicit time intervals should be thought of as:

  times = [1pm, 2pm, 3pm, 12am]
  current = 0
  for _ in range(count):
    time = times.wrapping_index(current)  # magic to wrap around
    await utils.sleep_until(time)
    await body()
    current += 1
2022-03-05 05:12:22 -05:00
Sebastian LawandGitHub f1ac25809c [tasks] Fix behavior when task overruns interval
In a scenario with `tasks.loop(seconds=5)`:

The task takes 30 seconds to run on the first two iterations, and then
is nearly instant for iterations afterward. The behavior should be
that the task runs at:

t = 0  (on time)
t = 30 (late, should've been at t = 5)
t = 60 (late, should've been at t = 10)
t = 60 (late, should've been at t = 15)
t = 60 (late, should've been at t = 20)
t = 60 (late, should've been at t = 25)
... 6 more iterations
t = 60 (on time)
t = 65 (on time)

In a scenario with a loop with explicit times set at UTC 1pm, 2pm, 
3pm, 4pm, and 5pm:

- The task takes 6 hour to run on the first iteration, and then is
  nearly instant for iterations afterward. Assuming the task is started
  at noon, the behavior should be that the task runs at `t = 0` and
  then at `t = 3600` 4 times ("catching up" on the missed iterations
  at 2pm, 3pm, 4pm, and 5pm).

- The task takes 30 days to run on the first iteration, and then is
  nearly instant for iterations afterward. Assuming the task is started
  at noon, the behavior should be that the task runs at `t = 0` and
  then at `t = 43200` 149 times ("catching up" on the missed
  iterations for the past month).

This behavior should be documented in the ext.tasks docs
2022-02-26 01:48:27 -05:00
Sebastian LawandGitHub 19ad64adda [tasks] Fix initial loop execution running prematurely 2022-02-21 20:45:03 -05:00
Sebastian LawandGitHub 3c6281ce33 Set attributes of StickerPack as Optional 2022-02-21 06:25:23 -05:00
Sebastian LawandGitHub 835432d161 Allow enums to be compared 2021-08-24 02:28:39 -04:00
Sebastian LawandGitHub 1d2eaf8526 [commands] reset view when Optional argument encounters parsing error 2021-08-19 19:56:28 -04:00
Sebastian LawandGitHub 07483297ad Fix typo in UserFlags.has_unread_urgent_messages 2021-07-21 02:47:36 -04:00
Sebastian LawandGitHub 124c4a3919 Add Template.url 2021-05-12 06:38:26 -04:00
Sebastian LawandGitHub f5727ff0d0 [tasks] fix regular task loops 2021-05-10 20:25:16 -04:00
Sebastian LawandGitHub 8bc489dba8 [tasks] Add support for explicit time parameter 2021-05-09 23:27:43 -04:00
Sebastian LawandGitHub b82a0dc6fd [docs] remove mentions of bot only usability 2021-05-04 07:21:59 -04:00