diff options
| author | 2020-06-29 19:11:52 -0700 | |
|---|---|---|
| committer | 2020-06-29 19:12:46 -0700 | |
| commit | 4fd2ff500cd889c1086334e82f695857689ae328 (patch) | |
| tree | d2ad6719ccd61d7db87468b75736581e8078e503 | |
| parent | Scheduler: only close unawaited coroutines (diff) | |
Scheduler: add details to class docstring
| -rw-r--r-- | bot/utils/scheduling.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bot/utils/scheduling.py b/bot/utils/scheduling.py index cf2a1f110..fc453f19e 100644 --- a/bot/utils/scheduling.py +++ b/bot/utils/scheduling.py @@ -8,7 +8,17 @@ from functools import partial class Scheduler: - """Task scheduler.""" + """ + Schedule the execution of coroutines and keep track of them. + + Coroutines can be scheduled immediately with `schedule` or in the future with `schedule_at` + or `schedule_later`. A unique ID is required to be given in order to keep track of the + resulting Tasks. Any scheduled task can be cancelled prematurely using `cancel` by providing + the same ID used to schedule it. The `in` operator is supported for checking if a task with a + given ID is currently scheduled. + + Any exception raised in a scheduled task is logged when the task is done. + """ def __init__(self, name: str): self.name = name |