Skip to content

Commit

Permalink
Remove some uneeded changes
Browse files Browse the repository at this point in the history
  • Loading branch information
catalystfd committed Nov 13, 2024
1 parent 972faca commit 912e758
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions classes/check/failingtaskcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace tool_heartbeat\check;
use tool_heartbeat\checker;
use core\check\check;
use core\check\result;

Expand All @@ -40,15 +39,12 @@ class failingtaskcheck extends check {
/** @var \stdClass $task Record of task that is failing **/
private $task;

/** @var \stdClass $config Configuration of task alerting defaults */
private $config;

/**
* Constructor
*/
public function __construct($task = null, $config = null) {
public function __construct($task = null) {
$this->task = $task;
$this->config = $config;

}

Expand Down Expand Up @@ -127,7 +123,7 @@ public function get_ref(): string {
* @return array of failing tasks
*/
public static function get_failing_tasks(): array {
global $DB, $CFG;
global $DB,
$tasks = [];

// Instead of using task API here, we read directly from the database.
Expand All @@ -136,7 +132,7 @@ public static function get_failing_tasks(): array {

foreach ($scheduledtasks as $task) {
$task->message = "SCHEDULED TASK: {$task->classname} Delay: {$task->faildelay}\n";
$tasks[] = new \tool_heartbeat\check\failingtaskcheck($task, $CFG->tool_heartbeat_tasks);
$tasks[] = new \tool_heartbeat\check\failingtaskcheck($task);
}

// Instead of using task API here, we read directly from the database.
Expand All @@ -151,7 +147,7 @@ public static function get_failing_tasks(): array {
// Only add duplicate message if there are more than 1.
$duplicatemsg = $record->count > 1 ? " ({$record->count} duplicates!!!)" : '';
$record->message = "ADHOC TASK: {$record->classname} Delay: {$record->faildelay} {$duplicatemsg}\n";
$tasks[] = new \tool_heartbeat\check\failingtaskcheck($record, $CFG->tool_heartbeat_tasks);
$tasks[] = new \tool_heartbeat\check\failingtaskcheck($record);
}
return $tasks;
}
Expand Down

0 comments on commit 912e758

Please sign in to comment.