37 Commits

Author SHA1 Message Date
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.
2020-05-10 17:00:23 -04:00
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.
2020-05-07 02:30:24 -04:00
Rapptz
540a88b762 [tasks] Replace stack-based implementation with a cleaner one. 2020-04-14 04:56:52 -04:00
Rapptz
d5211fb327 [tasks] Create different Loop objects for different instances
Fixes #2294
2020-04-14 04:35:49 -04:00
Josh B
20854de080 Allow for optional custom error handler in tasks extension 2020-04-04 03:11:25 -04:00
Epic
18c52671a9 Remove extra to in tasks docs 2020-04-04 03:09:21 -04:00
James
6a30f2749f [tasks] Add is_running property to Loop 2020-04-04 03:02:10 -04:00
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
2020-01-21 20:28:14 -05:00
Rapptz
02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
Rapptz
3149f15165 [tasks] Use new sleep_until util instead of internal function 2020-01-21 03:21:22 -05:00
Josh B
d7e925eb89 [tasks] Fix issue with next_iteration when task overruns time allotted 2020-01-21 03:18:25 -05:00
Josh B
a0b3e61b51 [tasks] Add Loop.next_iteration property 2020-01-20 07:22:21 -05:00
Rapptz
e1a237a0d3 Revert "[tasks] Add Loop.exception for more reliable exception retrieval."
This reverts commit 7a8c9e66d9c43a539fb78107ce3f51f16c7f30a2.
2019-11-19 21:59:39 -05:00
Rapptz
071c5b89e0 Revert "[tasks] Add support for explicit time parameter when running."
This reverts commit 9f822a1e6d904c4d7454ab77496b8a4f736073ab.
2019-11-19 21:59:27 -05:00
mathsman5133
7f65d9a8b1 [tasks] Add support for passing an argument list of exceptions. 2019-09-10 21:10:59 -04:00
Rapptz
9f822a1e6d [tasks] Add support for explicit time parameter when running.
Fixes #2159
2019-08-11 18:57:49 -04:00
Rapptz
7a8c9e66d9 [tasks] Add Loop.exception for more reliable exception retrieval. 2019-07-27 23:07:48 -04:00
Nihaal
9687740217 [tasks] Removed Returns from decorator docstring 2019-06-29 19:15:06 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Suhail
db9a293f14 [tasks] Add version added note to Loop.change_interval 2019-05-19 19:17:28 -04:00
Suhail6inkling
aadb6953ff [tasks] Add way to change interval at run-time
PR: #2162 
Fixes: #2158
2019-05-17 18:25:21 -04:00
Rapptz
6bc9d7c01a [tasks] Add indicator for internal task failure
Fixes #2151
2019-05-13 22:10:38 -04:00
Rapptz
a4a362b4c7 [tasks] Log exception when something failed to logging. 2019-05-13 22:08:31 -04:00
SnowyLuma
859ee751f9 [tasks] Return coro from before and after decorators 2019-05-13 20:29:07 -04:00
Rapptz
49a7e58d17 [tasks] Keep retrying before gracefully exiting. 2019-05-12 01:31:09 -04:00
Rapptz
4eead39b3c [tasks] Add Loop.stop to gracefully stop a task.
Updated docs will follow shortly.
2019-05-12 01:04:24 -04:00
Rapptz
bcdecd4e07 [tasks] Reset iteration count when loop terminates. 2019-05-12 00:49:19 -04:00
Steve C
8f111c521c
Fix typo in Loop.restart documentation 2019-05-10 18:44:07 -04:00
Rapptz
47808a7e96 [tasks] Add Loop.restart
This implementation waits until the task is done before starting it
again.

Closes #2075
2019-05-10 18:37:37 -04:00
Rapptz
91e00d8426 [tasks] Add way to query cancellation state for Loop.after_loop
Fixes #2121
2019-04-30 01:45:15 -04:00
Rapptz
55e3e242ff [tasks] Remove support for awaitables due to gotchas.
Fixes #2079
2019-04-29 23:34:20 -04:00
Danny
2a301a4eb4
[tasks] Fix assignment of tuple when appending 2019-04-15 14:49:52 -04:00
Steve C
ac2cda1ffc [tasks] set internal task to None after canceling 2019-04-12 20:56:40 -04:00
Rapptz
e46842a7cd [tasks] Add before_loop and after_loop decorators 2019-04-12 04:08:42 -04:00
Rapptz
4513dac7a3 [tasks] Ensure total number of seconds is not less than 0. 2019-04-11 08:21:45 -04:00
Rapptz
10bc939348 [tasks] Rename Loop.run to Loop.start to avoid blocking connotations 2019-04-11 08:19:32 -04:00
Rapptz
b0c7f48caf [tasks] Add a new background helper 'tasks' extension. 2019-04-11 08:04:26 -04:00