MDL-67667 core: Deprecate and removal task blocking
There are inherent issues with task blocking which mean that it has never worked properly. It is also very buggy and can lead to massive performance issues with task processing. It is almost impossible to deprecate this in a staged fashion because various APIs use the methods and it is not possible to determine which are API uses and which are other valid uses. In reality there has been little-to-no uptake on the use of this feature and it should just be removed.
This commit is contained in:
@@ -45,9 +45,6 @@ abstract class task_base {
|
||||
/** @var string $component - The component this task belongs to. */
|
||||
private $component = '';
|
||||
|
||||
/** @var bool $blocking - Does this task block the entire cron process. */
|
||||
private $blocking = false;
|
||||
|
||||
/** @var int $faildelay - Exponentially increasing fail delay */
|
||||
private $faildelay = 0;
|
||||
|
||||
@@ -120,10 +117,21 @@ abstract class task_base {
|
||||
|
||||
/**
|
||||
* Setter for $blocking.
|
||||
* @param bool $blocking
|
||||
*
|
||||
* Please note that task blocking is no longer supported.
|
||||
* If you are using it in older versions of Moodle you are strongly advised to rewrite your code
|
||||
* as has a detrimental impact upon performance.
|
||||
*
|
||||
* @deprecated since Moodle 4.4 See MDL-67667
|
||||
* @todo Remove in MDL-81509
|
||||
*/
|
||||
#[\core\attribute\deprecated(
|
||||
replacement: null,
|
||||
since: '4.4',
|
||||
reason: 'Blocking tasks are no longer supported',
|
||||
)]
|
||||
public function set_blocking($blocking) {
|
||||
$this->blocking = $blocking;
|
||||
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,16 +139,16 @@ abstract class task_base {
|
||||
*
|
||||
* @return bool
|
||||
* @deprecated since Moodle 4.4 See MDL-67667
|
||||
* @todo Remove in MDL-81509
|
||||
*/
|
||||
#[\core\attribute\deprecated(
|
||||
replacement: null,
|
||||
since: '4.4',
|
||||
reason: 'Blocking tasks are no longer supported',
|
||||
emit: false,
|
||||
)]
|
||||
public function is_blocking() {
|
||||
\core\deprecation::emit_deprecation_if_present(([$this, __FUNCTION__]);
|
||||
return $this->blocking;
|
||||
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user