schedule task "completion_daily_task" not completing

Re: schedule task "completion_daily_task" not completing

by Jim Lackey -
Number of replies: 0
Thank you for the reply, yes you are correct "$rs = $DB->get_recordset_sql($sql, array($now, $now, $now, $now));" is pointing to the results, I did try debugging first, but got nothing. I am not that familiar with this code so I am not sure where to start looking. If you have some suggestion on where to start looking that would be great. I did break the sql query out and ran it manually and it does complete, take about 1-2 minutes. If you look at the above sample of output I am see a lot of repeated lines for the course - userid. not sure is this is normal

This is all I get from a manual run with the --showsql --showdebugging
php -e admin/tool/task/cli/schedule_task.php --execute='\core\task\completion_daily_task' --showsql --showdebugging
--------------------------------
SELECT * FROM mdl_task_scheduled WHERE classname = ?
[array (
0 => '\\core\\task\\completion_daily_task',
)]
--------------------------------
Query took: 0.00058197975158691 seconds.
--------------------------------
--------------------------------
SELECT * FROM mdl_user WHERE id = ? AND deleted = ?
[array (
0 => '2280',
1 => 0,
)]
--------------------------------
Query took: 0.00077199935913086 seconds.
--------------------------------
--------------------------------
SELECT * FROM mdl_context WHERE contextlevel = ? AND instanceid = ?
[array (
0 => 50,
1 => '1',
)]
--------------------------------
Query took: 0.0003509521484375 seconds.
--------------------------------
Execute scheduled task: Completion mark as started (core\task\completion_daily_task)
Marking users as started
--------------------------------

SELECT
c.id AS course,
u.id AS userid,
crc.id AS completionid,
ue.timestart AS timeenrolled,
ue.timecreated
FROM
mdl_user u
INNER JOIN
mdl_user_enrolments ue
ON ue.userid = u.id
INNER JOIN
mdl_enrol e
ON e.id = ue.enrolid
INNER JOIN
mdl_course c
ON c.id = e.courseid
INNER JOIN
mdl_role_assignments ra
ON ra.userid = u.id
LEFT JOIN
mdl_course_completions crc
ON crc.course = c.id
AND crc.userid = u.id
WHERE
c.enablecompletion = 1
AND crc.timeenrolled IS NULL
AND ue.status = 0
AND e.status = 0
AND u.deleted = 0
AND ue.timestart < ?
AND (ue.timeend > ? OR ue.timeend = 0)
AND ra.roleid IN (5,9)
ORDER BY
course,
userid

[array (
0 => 1576086444,
1 => 1576086444,
)]
--------------------------------

it just drops out while doing the query, no messages, I also check the log file for and saw nothing

Regards,
Jim