18 Commits

Author SHA1 Message Date
Dylan K. Taylor
177b963d8e
TaskScheduler: do not push cancelled repeating tasks back onto the queue 2021-04-19 13:23:31 +01:00
Dylan K. Taylor
d8d994351b phpstan 0.12.29 2020-06-14 16:25:55 +01:00
Dylan K. Taylor
5a8917f6f2 TaskScheduler: queue contains TaskHandler, not Task 2020-05-16 15:27:20 +01:00
Dylan K. Taylor
9cd6b3e1c7 fix remaining multiline @var annotations 2020-01-22 14:44:36 +00:00
Dylan K. Taylor
c4793241f5 Mass removal of useless @param/@return PHPDoc annotations, pass 1 2020-01-21 15:10:18 +00:00
Dylan K. Taylor
f5a18df835 scheduler: populate missing return type information 2020-01-19 17:11:12 +00:00
Dylan K. Taylor
4eaea54b0e TaskScheduler: fixed wrong typehints
These methods never return null.
2019-02-22 17:47:28 +00:00
Dylan K. Taylor
e26af3fa1b TaskScheduler: don't catch unexpected exceptions
this means that errors in scheduled tasks which are uncaught will now cause a server crash.
2018-11-04 23:22:30 +00:00
Dylan K. Taylor
95787c2be9 TaskScheduler: fixed tasks not getting destroyed when all tasks in scheduler are cancelled before next heartbeat
they got removed from the tasks array, but not from the queue (for performance reasons). The queue gets cleaned up by the heartbeat, but it was checking if there were things in the main array, not in the queue.

There are a couple of other bugs with cancelling tasks that this doesn't fix that are rather more complicated to deal with.
2018-06-21 12:49:08 +01:00
Dylan K. Taylor
02b4eeeb9b TaskScheduler: Remove repeating tasks which throw exceptions 2018-05-31 14:10:59 +01:00
Dylan K. Taylor
6b4b4e4bb1 TaskScheduler: remove redundant else branch 2018-05-31 13:01:06 +01:00
Dylan K. Taylor
f2b8d6879f TaskScheduler: remove leftover code that makes no sense
this is impossible now that we have typehints
2018-05-31 12:52:29 +01:00
Dylan K. Taylor
60212cef2f TaskScheduler: adjust disabled scheduler exception 2018-05-31 12:38:36 +01:00
Dylan K. Taylor
15270f8329 Fixed plugin schedulers crashing after disable/reenable 2018-05-31 12:34:22 +01:00
Dylan K. Taylor
18fdbc2834 TaskScheduler: fix typo in isReady() parameter 2018-05-30 16:45:37 +01:00
Dylan K. Taylor
a8c766be88 Remove TaskHandler dependency on MainLogger
This instead allows the exception to be caught by the scheduler and reported using its logger.
2018-05-30 16:00:25 +01:00
Dylan K. Taylor
e20be3eeba Move task timings responsibility from scheduler to handler 2018-05-30 15:38:39 +01:00
Dylan K. Taylor
51f43fb375 Removed global ServerScheduler - plugins now get their own isolated schedulers
This change breaks pretty much all API pertaining to synchronous task scheduling.

Significant changes:
- Server->getScheduler() has been removed
- Plugin->getScheduler() has been added - every plugin now has its own scheduler
- Because schedulers are now per-plugin, it is now unnecessary for PluginTask to exist because stopping plugin tasks on plugin disable is as simple as destroying the plugin's scheduler. Therefore PluginTask has now been removed and it is expected for things to now use the base Task class instead.

For the most part, plugins will simply need to change Plugin->getServer()->getScheduler()->... to Plugin->getScheduler()->...
Another highlight is that plugin tasks now no longer have global IDs - they are unique to each scheduler.
2018-05-30 14:11:11 +01:00