55 Commits

Author SHA1 Message Date
Dylan K. Taylor
dfd8c4e4b8
TaskScheduler: throw an exception if attempting to heartbeat a disabled scheduler 2022-03-03 18:49:17 +00:00
Dylan K. Taylor
b85fe0e72a
Replace disallowed operators in src/scheduler/ 2022-01-20 19:20:03 +00:00
Dylan K. Taylor
e34364412b
Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Dylan K. Taylor
2696698926
ClosureTask: relax closure checks to allow arrow functions without return typehints
nobody uses return typehints on arrow functions anyway .. they just waste space.
2021-10-10 23:31:57 +01:00
Dylan K. Taylor
c931c52617
AsyncTask: added newline 2021-09-27 13:53:30 +01:00
Dylan K. Taylor
b3e8314b9f
PTHREADS_INHERIT_CONSTANTS is no longer needed for MainLogger to log exceptions
cleaned paths are now referenced from Filesystem instead of namespace constants.
2021-09-26 21:41:24 +01:00
Dylan K. Taylor
f5a4baf3cf
AsyncTask: regroup some methods into more sensible places
how the fuck is anyone supposed to find anything??
2021-08-20 23:00:39 +01:00
Dylan K. Taylor
5fbc7681b0
Allow registering multiple ClassLoaders for a thread 2021-07-15 19:00:40 +01:00
Dylan T
32d7b1e6af
Start using webmozart/pathutil for joining paths (#4287) 2021-06-29 19:40:43 +01:00
Dylan K. Taylor
22b5e5db5e
AsyncPool: Do not drop pending tasks on shutdown
this creates an extra element of uncertainty for async pool usage.
2021-06-11 18:30:32 +01:00
Dylan K. Taylor
f245147c11
AsyncPool: make collectTasks() return value more accurate
during onCompletion() anything may happen, including scheduling new tasks, which the previous code did not account for.
2021-06-11 18:30:32 +01:00
Dylan K. Taylor
94928c030a
Removed CancellableClosureTask 2021-04-19 14:00:23 +01:00
Covered123
9c1b4fd1cd
Added CancelTaskException (#4186) 2021-04-19 13:41:51 +01:00
Dylan K. Taylor
5872b2fe23
Merge remote-tracking branch 'origin/stable' 2021-04-19 13:32:15 +01:00
Dylan K. Taylor
b3c6c11b20
BulkCurlTask now accepts a closure callback for onCompletion
this requires much less boilerplate code than an anonymous class.
2021-03-16 23:56:14 +00:00
Dylan K. Taylor
dcf53bd06d
BulkCurlTask: fixed reference to removed function [ci skip] 2021-03-16 23:38:07 +00:00
Dylan K. Taylor
c61f66d973
Removed ext-ds dependency 2021-02-11 15:40:37 +00:00
Dylan K. Taylor
54d9342ed9
AsyncPool: Always collect workers, even if the task queue is empty
because of the way async tasks are processed, we might collect results from a task before it's able to be collected by collect(). Therefore, the queue might be empty, even though there are still tasks to be collected.
2021-02-04 21:43:53 +00:00
Dylan K. Taylor
c5693598aa
BulkCurlTask constructor now accepts BulkCurlTaskOperation[] instead of shaped arrays 2020-12-20 22:18:03 +00:00
Dylan K. Taylor
29f6ed3f68 Use Snooze to improve AsyncTask collection times
regardless of how long an async task takes to run, it will take a multiple of 50ms to get the result processed. This delay causes issues in some cases for stuff like generation, which causes locking of adjacent chunks, and async packet compression, which experiences elevated latency because of this problem.
This is not an ideal solution for packet compression since it will cause the sleeper handler to get hammered, but since it's already getting hammered by every packet from RakLib, I don't think that's a big problem.
2020-12-02 19:34:34 +00:00
Dylan K. Taylor
f5e033ad5d AsyncPool: fixed stable merge error 2020-10-23 13:25:52 +01:00
Dylan K. Taylor
23e5ade77e Merge branch 'stable' into master
# Conflicts:
#	build/make-release.php
#	composer.lock
#	resources/vanilla
#	src/plugin/PluginDescription.php
#	src/pocketmine/entity/Human.php
2020-10-21 16:55:52 +01:00
Dylan K. Taylor
75e3a0aa0f Merge branch 'stable' into master
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/command/defaults/StatusCommand.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/level/format/SubChunk.php
2020-09-26 13:27:08 +01:00
Dylan K. Taylor
6bca38999d scheduler: removing task IDs
These no longer serve any purpose that can't be replaced with a structure like Ds\Set, SplObjectStorage, or just using spl_object_id().
2020-07-08 12:01:48 +01:00
Dylan K. Taylor
d738504e24 TaskScheduler: use a Ds\Set to index tasks internally
this removes all remaining use-cases for taskID.
2020-07-08 11:57:48 +01:00
Dylan K. Taylor
dca4bf424e TaskHandler: change isQueued() to accept TaskHandler instead of int 2020-07-08 11:53:47 +01:00
Dylan K. Taylor
a71b111b50 TaskScheduler: get rid of cancelTask()
developers should be using TaskHandler->cancel() instead.
2020-07-08 11:49:43 +01:00
Dylan K. Taylor
da798817b5 Merge branch 'stable'
# Conflicts:
#	changelogs/3.14.md
#	resources/vanilla
#	src/VersionInfo.php
#	src/entity/Attribute.php
2020-07-08 11:46:02 +01:00
Dylan K. Taylor
b79aa04530 remove unused FileWriteTask 2020-07-07 21:21:13 +01:00
Dylan K. Taylor
82b3e3398b make more use of igbinary_serialize() and igbinary_unserialize() 2020-06-17 23:03:03 +01:00
Dylan K. Taylor
f55a7f8b53 Merge commit 'd8d994351'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-14 19:47:21 +01:00
Dylan K. Taylor
eeec775ff6 Merge commit '5a8917f6f21205d074ce3e9d2f9325e427f9d254'
# Conflicts:
#	resources/vanilla
2020-05-18 10:32:20 +01:00
Dylan K. Taylor
65f82f5cdf Task::onRun() and Task::onCancel() now require :void return typehints 2020-05-17 13:58:01 +01:00
Dylan T
67666db827
Task: Remove currentTick parameter (#3498)
This parameter is not used for the vast majority of task use cases and just serves as extra useless boilerplate code, especially for closure-based tasks.
This use case can be replaced using Server->getTick() in the cases where it matters.
2020-05-16 15:28:45 +01:00
Dylan K. Taylor
f9a587d40e imports cleanup 2020-04-28 17:27:38 +01:00
Dylan K. Taylor
f91e2f41e0 move SendUsageTask to stats namespace
maybe separate this out into a library?
2020-04-26 11:42:48 +01:00
Dylan K. Taylor
163c3855eb Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/plugin/PluginBase.php
#	src/plugin/PluginDescription.php
#	src/pocketmine/Player.php
#	src/pocketmine/network/rcon/RCON.php
#	src/pocketmine/network/rcon/RCONInstance.php
#	src/pocketmine/scheduler/AsyncTask.php
#	src/pocketmine/tile/Spawnable.php
#	src/scheduler/AsyncPool.php
#	src/utils/Config.php
#	src/utils/Timezone.php
#	src/utils/UUID.php
#	src/utils/Utils.php
#	src/world/format/io/region/RegionLoader.php
2020-04-19 11:13:41 +01:00
Dylan K. Taylor
7b3c2a3703 Merge commit '3907a2b6ba58fa49022e3e7c8256731dfa2e0d00' 2020-03-14 13:32:35 +00:00
Dylan K. Taylor
d2aca6023b add native return types to closures (for phpstan) 2020-02-07 22:05:15 +00:00
Dylan K. Taylor
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
Dylan K. Taylor
cb16f5c142 Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/lang/Language.php
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/permission/Permission.php
#	src/pocketmine/block/Leaves.php
#	src/pocketmine/entity/DataPropertyManager.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
#	src/pocketmine/tile/Banner.php
#	src/scheduler/BulkCurlTask.php
#	src/updater/AutoUpdater.php
#	src/utils/Config.php
#	src/utils/Utils.php
#	src/world/generator/Flat.php
#	src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
Dylan K. Taylor
9b9b955762 Merge commit '0537c66849b307465159306981bad78ba902f30b'
# Conflicts:
#	resources/vanilla
#	src/scheduler/BulkCurlTask.php
2020-01-31 19:47:59 +00:00
Dylan K. Taylor
5c4487c980 added some callable prototypes for phpstan 2020-01-29 19:56:16 +00:00
Dylan K. Taylor
a604176ac2 Merge branch 'stable' 2020-01-29 16:11:51 +00:00
Dylan K. Taylor
055b13a6cf strip extra blank lines (php-cs-fixer) 2020-01-22 15:14:10 +00:00
Dylan K. Taylor
cd55cdf5c6 Merge commit '9cd6b3e1c7cd81d0a4b0da68d9b3ff026c9f6495' 2020-01-22 15:04:06 +00:00
Dylan K. Taylor
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
Dylan K. Taylor
3ee6887792 populate remaining missing return types, using native returns where possible
this is done separately to stable so that stable changes can be integrated easily using an empty merge.
2020-01-19 10:26:35 +00:00
Dylan K. Taylor
0e1cea043a added some phpstan-specific generic type annotations 2020-01-13 15:05:02 +00:00
Dylan K. Taylor
aba71762e9 master-specific @var annotations 2020-01-09 17:50:01 +00:00