Commit Graph

231 Commits

Author SHA1 Message Date
c3fabe833e FileWriteTask: mark as deprecated 2020-06-10 11:22:18 +01:00
8c0d441a13 Merge branch 'stable' into next-minor 2020-05-17 10:03:17 +01:00
5a8917f6f2 TaskScheduler: queue contains TaskHandler, not Task 2020-05-16 15:27:20 +01:00
755919c496 SendUsageTask: explicitly assume that json_encode() will not return false 2020-04-15 12:43:05 +01:00
88b216a17b AsyncTask: fix another phpstan level 7 error about wrong types
this should really be a dedicated type, but everything done with pthreads sucks.
2020-04-15 12:42:18 +01:00
8020912448 AsyncPool: add phpstan array type information to all fields 2020-04-15 12:40:54 +01:00
5571ae05b5 AsyncPool: silence a warning about wrong key type
getTaskId() returns int|null, although it won't happen after the ID has been set.
2020-04-15 12:40:23 +01:00
3907a2b6ba Process: split getMemoryUsage() into 2 functions
this isn't released yet so it's OK to change.
phpstan level 7 doesn't like these kinds of ambiguous return types because there's no way for it to tell which type is returned without a return type specifying extension, and it's easier to just change the API than to make PHPStan understand it.
2020-03-13 17:32:17 +00:00
2d51971b84 Revert "ClosureTask: drop requirement for void return type"
This reverts commit 9e993aa83f.

apparently PHPStan isn't cool with this ...
2020-02-10 11:40:47 +00:00
f08e411cad Merge branch 'stable' into next-minor 2020-02-10 11:40:08 +00:00
1a5228e7a6 Fixed property types with missing null PhpDoc types 2020-02-05 20:55:03 +00:00
260ac47588 add some phpstan array types 2020-01-30 22:23:11 +00:00
0537c66849 populate missing array value types in scheduler namespace 2020-01-30 21:19:15 +00:00
2b402e525a add some PHPStan-specific callable prototypes 2020-01-29 15:03:55 +00:00
f624871b3f strip extra blank lines (php-cs-fixer) 2020-01-22 14:50:29 +00:00
9cd6b3e1c7 fix remaining multiline @var annotations 2020-01-22 14:44:36 +00:00
c4793241f5 Mass removal of useless @param/@return PHPDoc annotations, pass 1 2020-01-21 15:10:18 +00:00
f5a18df835 scheduler: populate missing return type information 2020-01-19 17:11:12 +00:00
1eedac87b2 added missing @var property types (reported by phpstan) 2020-01-09 14:13:54 +00:00
9a67192f74 Merge branch 'stable' into next-minor 2019-12-03 10:45:51 +00:00
0890b5fc99 AsyncPool: assert() that the unstacked task is actually an AsyncTask
it's possible that it might not be if the workers were accessed directly, but that shouldn't be possible.
This also silences a PHPStan warning on level 2.
2019-12-01 19:28:05 +00:00
0591458ef6 Merge branch 'stable' into next-minor 2019-10-22 18:49:22 +01:00
e198c8fa8b Task: mark taskHandler field as nullable 2019-10-22 10:26:49 +01:00
cde2c10c1d AsyncTask: partial backport of 6ac0c517f5 (simplify TLS)
- deprecated AsyncTask::peekLocal()
- AsyncTask::fetchLocal() no longer deletes stored data
2019-07-27 15:09:42 +01:00
87fb42cabd Merge branch 'stable' into next-minor 2019-07-27 14:53:13 +01:00
cb40484a2e AsyncTask: Remove a bunch of reference-management drivel from documentation of storeLocal()
this works (mostly) the same way regular properties do, so the usual rules are implied.
2019-07-27 14:52:53 +01:00
6566dd8c8f AsyncPool: Remove useless warning about complex data leftovers
this is automatically cleaned up anyway, so this warning is just redundant noise.
2019-07-27 14:44:40 +01:00
1e65ac0d85 Merge branch 'stable' into next-minor 2019-07-27 14:40:31 +01:00
e75a08a5a3 AsyncPool: ensure TLS is always cleaned on task removal, closes #3059 2019-07-27 14:39:40 +01:00
cb247a5f28 AsyncTask: Deprecate methods removed in 2c4f2810d2 2019-07-26 19:52:26 +01:00
bb048fb361 Merge branch 'stable' into next-minor 2019-07-26 19:50:17 +01:00
d55889d85f AsyncTask: fixing docs 2019-07-26 19:41:45 +01:00
99f65f19ac BulkCurlTask: point to the right place in docs 2019-07-26 19:18:09 +01:00
581eeee01d fix rogue @package doc making doxygen choke 2019-07-26 19:15:02 +01:00
9e993aa83f ClosureTask: drop requirement for void return type
this creates unnecessary boilerplate for many inline usages.
2019-07-01 17:19:19 +01:00
4635b93f4d backport 23071d257 + deprecations: Extract process-related functions from Utils into a separate Process class 2019-06-16 14:40:51 +01:00
4eaea54b0e TaskScheduler: fixed wrong typehints
These methods never return null.
2019-02-22 17:47:28 +00:00
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
6bd1491b8b AsyncPool: Apply a cooldown to workers to cut down unnecessary GC lag spikes
Since 3.2 there have been some runtime performance issues related to garbage collection and dynamic AsyncWorker booting. This is partly because of GC being dumb about shutting down what it thinks are "unused" workers. A worker which has been idle for a single tick is considered the same as a worker which has been idle for hours. The result of this is that on active servers, workers would get shut down and then immediately restarted because of something like chunk sending. Since booting an async worker is frightfully expensive, this causes lag spikes, which is obviously bad.

This commit changes the GC mechanism to only shutdown workers which have not been used for the last 5 minutes.
2019-01-03 15:06:53 +00:00
a95694ed06 Add signature validation for some user-defined callbacks 2018-12-04 18:33:58 +00:00
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
755db3dac8 Added a ClosureTask implementation for easier task scheduling (#2497) 2018-11-04 22:55:40 +00:00
0543c17849 Merge branch 'release/3.3' into release/3.4 2018-11-04 22:15:46 +00:00
046c39b02e Remove some Throwable abuse in AsyncTasks 2018-11-04 22:15:06 +00:00
87b471ce0f AsyncPool: reverse e0d5c79848, don't catch unexpected exceptions thrown by onCompletion()
this should never throw an uncaught exception, and if it does it indicates broken code.
2018-11-04 22:09:30 +00:00
9caf62778c AsyncTask: remove $serialize parameter from setResult()
Whether serialization is necessary can be determined automatically based on the type of variable.
2018-11-03 16:56:24 +00:00
f0182c9996 TaskHandler: remove incorrect internal warning
this is perfectly fine to use, and preferable to getting a cyclic ref to the scheduler. TaskScheduler->cancelTask() does pretty much the exact same thing, and the scheduler internals are designed to deal with this anyway.
2018-11-03 12:12:02 +00:00
ab48d85c35 Properly deal with anonymous tasks in timings 2018-10-31 18:51:30 +00:00
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
2858db430e Fixed AsyncTask publishProgress() race condition on task exit
It's possible for a progress update to be lost due to the task finishing before the main thread found the progress update.
2018-10-10 13:41:15 +01:00