Josh
42a538edda
[tasks] Replace None check with MISSING check in task loop
4 years ago
Josh
ef22178dee
[tasks] Type hint the tasks extension
4 years ago
Sebastian Law
f5727ff0d0
[tasks] fix regular task loops
4 years ago
Sebastian Law
8bc489dba8
[tasks] Add support for explicit time parameter
4 years ago
Steve C
ef9bb79e91
[tasks] Move the Loop's sleep to be before exit conditions
This change makes it more so that `Loop.stop()` gracefully makes the
current iteration the final one, by waiting AND THEN returning.
The current implementation is closer to `cancel`, while also not.
I encountered this because I was trying to run a
`@tasks.loop(count=1)`, and inside it I print some text and change the
interval, and in an `after_loop`, I restart the loop.
Without this change, it immediately floods my console, due to
not waiting before executing `after_loop`.
4 years ago
Rapptz
99fc950510
Use f-strings in more places that were missed.
4 years ago
Nadir Chowdhury
89456022cf
Add `__all__` to remaining modules
4 years ago
Rapptz
9d39b135f4
Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
4 years ago
Sebastian Law
f7a4bef4ff
[tasks] remove redundant condition in Loop.next_iteration
self._task is only None if the Loop has never been started before,
which means None should be returned always, regardless of how
many seconds was passed into the constructor
this didn't break anything before because self._next_iteration will
be None as well if self._task is None.
4 years ago
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery
4 years ago
Sebastian Law
ceab8ff638
[tasks] make __call__ actually appear in the docs
4 years ago
Nihaal Sangha
69bdc3a184
Change copyright year to present
4 years ago
Rapptz
6515f33978
[tasks] Fix a typo in documentation
4 years ago
Rapptz
0216db0c0a
[tasks] Add support for manually calling the wrapped coroutine
4 years ago
Rapptz
ccdf4c4ad6
[tasks] Lazily fetch event loop if one isn't provided
Fixes #5808
5 years ago
Josh
6baacb2c23
[tasks] Don't update _next_iteration on retry
5 years ago
Dan Hess
fc951873a1
[tasks] Remove HTTPException as an exception to silently continue for
5 years ago
Rapptz
b8154e365f
Rewrite gateway to use aiohttp instead of websockets
5 years ago
James
61216112d0
Add a licence and encoding declaration to missing files
5 years ago
Josh
6b5be39cd2
[tasks] Fix issue with default error handler in class context
5 years ago
Steve C
4b3a7fbe16
[tasks] Allow Loop.cancel in Loop.before_loop
Task cancel raises on the next awaited coro, so I've added this 0-sleep "hack"
I'm internally debating if leaving the comment there, but I'm sure it would confuse the uninformed of this trick.
5 years ago
Steve C
0fd5eca0d5
[tasks] Fix tasks decorators being discarded
At this moment, when a task seems to be first loaded, it immediately throws away the decorators you give it, and just generates a new instance of itself.
In your cog's `__init__`, once you do `self.my_task.start()`, the Loop is remade when it gets to `self.my_task` before executing the `start` function. The original Loop that the cog starts with is where the decorated values are. This fixes that.
5 years ago
Rapptz
540a88b762
[tasks] Replace stack-based implementation with a cleaner one.
5 years ago
Rapptz
d5211fb327
[tasks] Create different Loop objects for different instances
Fixes #2294
5 years ago
Josh B
20854de080
Allow for optional custom error handler in tasks extension
5 years ago
Epic
18c52671a9
Remove extra to in tasks docs
5 years ago
James
6a30f2749f
[tasks] Add is_running property to Loop
5 years ago
Josh B
d0a1956be9
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
5 years ago
Rapptz
02397306b2
Drop superfluous zero in version related changes in the documentation
5 years ago
Rapptz
3149f15165
[tasks] Use new sleep_until util instead of internal function
5 years ago
Josh B
d7e925eb89
[tasks] Fix issue with next_iteration when task overruns time allotted
5 years ago
Josh B
a0b3e61b51
[tasks] Add Loop.next_iteration property
5 years ago
Rapptz
e1a237a0d3
Revert "[tasks] Add Loop.exception for more reliable exception retrieval."
This reverts commit 7a8c9e66d9
.
5 years ago
Rapptz
071c5b89e0
Revert "[tasks] Add support for explicit time parameter when running."
This reverts commit 9f822a1e6d
.
5 years ago
mathsman5133
7f65d9a8b1
[tasks] Add support for passing an argument list of exceptions.
6 years ago
Rapptz
9f822a1e6d
[tasks] Add support for explicit time parameter when running.
Fixes #2159
6 years ago
Rapptz
7a8c9e66d9
[tasks] Add Loop.exception for more reliable exception retrieval.
6 years ago
Nihaal
9687740217
[tasks] Removed Returns from decorator docstring
6 years ago
NCPlayz
3c9bcc2851
Improve documentation
6 years ago
Suhail
db9a293f14
[tasks] Add version added note to Loop.change_interval
6 years ago
Suhail6inkling
aadb6953ff
[tasks] Add way to change interval at run-time
PR: #2162
Fixes : #2158
6 years ago
Rapptz
6bc9d7c01a
[tasks] Add indicator for internal task failure
Fixes #2151
6 years ago
Rapptz
a4a362b4c7
[tasks] Log exception when something failed to logging.
6 years ago
SnowyLuma
859ee751f9
[tasks] Return coro from before and after decorators
6 years ago
Rapptz
49a7e58d17
[tasks] Keep retrying before gracefully exiting.
6 years ago
Rapptz
4eead39b3c
[tasks] Add Loop.stop to gracefully stop a task.
Updated docs will follow shortly.
6 years ago
Rapptz
bcdecd4e07
[tasks] Reset iteration count when loop terminates.
6 years ago
Steve C
8f111c521c
Fix typo in Loop.restart documentation
6 years ago
Rapptz
47808a7e96
[tasks] Add Loop.restart
This implementation waits until the task is done before starting it
again.
Closes #2075
6 years ago
Rapptz
91e00d8426
[tasks] Add way to query cancellation state for Loop.after_loop
Fixes #2121
6 years ago