Oh sorry. To give
context, I am creating an Activity Module that's supposed to send a file which the user uploaded (through background task) during the creation of its instance.
However, the background task wouldn't execute
unless I access the 'localhost/moodle/admin/cron.php' page.
In regards to timeouts, I can't seem to replicate it. I'm sorry (IIRC it was some h5p task, not my module's, and it failed because it exceeds the 120 sec limit). That being said, I am glad that it is dependent on the server's capability. I am developing the app on my own laptop (with XAMPP no less), but on a real use case scenario, the module would probably be used on a real server so timeout wouldn't be an issue.
And the output of the cron.php is pretty normal:
Server Time: Sun, 27 Feb 2022 03:03:26 +0100
Execute scheduled task: Background processing for tags (core\task\tag_cron_task)
... started 03:03:26. Current memory use 21.6MB.
... used 6 dbqueries
... used 0.97955679893494 seconds
Scheduled task complete: Background processing for tags (core\task\tag_cron_task)
Execute scheduled task: Cohort enrolment sync task (enrol_cohort\task\enrol_cohort_sync)
... started 03:03:28. Current memory use 22.6MB.
... used 7 dbqueries
... used 0.052457094192505 seconds
Scheduled task complete: Cohort enrolment sync task (enrol_cohort\task\enrol_cohort_sync)
Execute scheduled task: Cleanup old sessions (core\task\session_cleanup_task)
... started 03:03:28. Current memory use 23.2MB.
... used 7 dbqueries
... used 0.032294034957886 seconds
Scheduled task complete: Cleanup old sessions (core\task\session_cleanup_task)
Execute scheduled task: Send new user passwords (core\task\send_new_user_passwords_task)
... started 03:03:28. Current memory use 23.5MB.
... used 1 dbqueries
... used 0.0026578903198242 seconds
Scheduled task complete: Send new user passwords (core\task\send_new_user_passwords_task)
Execute scheduled task: Send failed login notifications (core\task\send_failed_login_notifications_task)
... started 03:03:28. Current memory use 23.5MB.
... used 0 dbqueries
... used 0.00016593933105469 seconds
Scheduled task complete: Send failed login notifications (core\task\send_failed_login_notifications_task)
Execute scheduled task: Legacy cron processing for plugins (core\task\legacy_plugin_cron_task)
... started 03:03:29. Current memory use 23.5MB.
Running auth crons if required...
Running enrol crons if required...
Starting activity modules
Finished activity modules
Starting blocks
Finished blocks
Starting admin reports
Finished admin reports
Starting course reports
Finished course reports
Starting gradebook plugins
Finished gradebook plugins
... used 2 dbqueries
... used 0.072503089904785 seconds
Scheduled task complete: Legacy cron processing for plugins (core\task\legacy_plugin_cron_task)
Execute scheduled task: Background processing for assignment module (mod_assign\task\cron_task)
... started 03:03:29. Current memory use 30.3MB.
... used 3 dbqueries
... used 0.095720052719116 seconds
Scheduled task complete: Background processing for assignment module (mod_assign\task\cron_task)
Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
... started 03:03:29. Current memory use 34.5MB.
Removing old digest records from 7 days ago.
Removed all old digest records.
Fetching unmailed posts.
No posts found.
... used 2 dbqueries
... used 0.27527093887329 seconds
Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
Execute scheduled task: Background processing for gradebook (core\task\grade_cron_task)
... started 03:03:30. Current memory use 34.5MB.
... used 2 dbqueries
... used 0.031793117523193 seconds
Scheduled task complete: Background processing for gradebook (core\task\grade_cron_task)
Execute scheduled task: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)
... started 03:03:30. Current memory use 38.2MB.
Looking for quiz overdue quiz attempts...
Considered 0 attempts in 0 quizzes.
... used 1 dbqueries
... used 0.42797780036926 seconds
Scheduled task complete: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)
Execute scheduled task: Legacy cron quiz reports (mod_quiz\task\legacy_quiz_reports_cron)
... started 03:03:31. Current memory use 38.2MB.
... used 0 dbqueries
... used 0.00057482719421387 seconds
Scheduled task complete: Legacy cron quiz reports (mod_quiz\task\legacy_quiz_reports_cron)
Execute scheduled task: Legacy cron quiz access rules (mod_quiz\task\legacy_quiz_accessrules_cron)
... started 03:03:31. Current memory use 38.2MB.
... used 0 dbqueries
... used 0.0005500316619873 seconds
Scheduled task complete: Legacy cron quiz access rules (mod_quiz\task\legacy_quiz_accessrules_cron)
Execute scheduled task: Calculate regular completion data (core\task\completion_regular_task)
... started 03:03:31. Current memory use 38.2MB.
Running completion_criteria_date->cron()
Running completion_criteria_activity->cron()
Running completion_criteria_duration->cron()
Running completion_criteria_grade->cron()
Running completion_criteria_course->cron()
Aggregating completions
... used 6 dbqueries
... used 0.03792405128479 seconds
Scheduled task complete: Calculate regular completion data (core\task\completion_regular_task)
Execute scheduled task: Background processing for portfolio plugins (core\task\portfolio_cron_task)
... started 03:03:31. Current memory use 38.5MB.
... used 0 dbqueries
... used 0.00027608871459961 seconds
Scheduled task complete: Background processing for portfolio plugins (core\task\portfolio_cron_task)
Execute scheduled task: Background processing for legacy cron in plagiarism plugins (core\task\plagiarism_cron_task)
... started 03:03:32. Current memory use 38.5MB.
... used 0 dbqueries
... used 0.00017595291137695 seconds
Scheduled task complete: Background processing for legacy cron in plagiarism plugins (core\task\plagiarism_cron_task)
Execute scheduled task: Background processing for workshop module (mod_workshop\task\cron_task)
... started 03:03:32. Current memory use 38.5MB.
processing workshop subplugins ...
... used 1 dbqueries
... used 0.099501848220825 seconds
Scheduled task complete: Background processing for workshop module (mod_workshop\task\cron_task)
Execute scheduled task: Send calendar notifications (core\task\calendar_cron_task)
... started 03:03:32. Current memory use 38.6MB.
... used 1 dbqueries
... used 0.023709058761597 seconds
Scheduled task complete: Send calendar notifications (core\task\calendar_cron_task)
Execute scheduled task: Sync external blogs (core\task\blog_cron_task)
... started 03:03:32. Current memory use 39MB.
... used 2 dbqueries
... used 0.048816919326782 seconds
Scheduled task complete: Sync external blogs (core\task\blog_cron_task)
Execute scheduled task: Legacy cron workshop allocation (mod_workshop\task\legacy_workshop_allocation_cron)
... started 03:03:32. Current memory use 39.3MB.
... used 0 dbqueries
... used 0.00058412551879883 seconds
Scheduled task complete: Legacy cron workshop allocation (mod_workshop\task\legacy_workshop_allocation_cron)
Execute scheduled task: Incoming email pickup (tool_messageinbound\task\pickup_task)
... started 03:03:33. Current memory use 39.8MB.
Inbound Message not fully configured - exiting early.
... used 0 dbqueries
... used 0.0021231174468994 seconds
Scheduled task complete: Incoming email pickup (tool_messageinbound\task\pickup_task)
Execute scheduled task: Background processing for cleaning up question previews (core\task\question_preview_cleanup_task)
... started 03:03:33. Current memory use 40MB.
Cleaning up old question previews...done.
... used 2 dbqueries
... used 0.020812034606934 seconds
Scheduled task complete: Background processing for cleaning up question previews (core\task\question_preview_cleanup_task)
Execute scheduled task: Background processing for cleaning up question statistics caches (core\task\question_stats_cleanup_task)
... started 03:03:33. Current memory use 40MB.
Cleaning up old question statistics cache records...done.
... used 4 dbqueries
... used 0.23007321357727 seconds
Scheduled task complete: Background processing for cleaning up question statistics caches (core\task\question_stats_cleanup_task)
Execute scheduled task: Cleanup event monitor events (tool_monitor\task\clean_events)
... started 03:03:34. Current memory use 40MB.
... used 0 dbqueries
... used 0.00061798095703125 seconds
Scheduled task complete: Cleanup event monitor events (tool_monitor\task\clean_events)
Execute scheduled task: Background processing for scheduled allocation (workshopallocation_scheduled\task\cron_task)
... started 03:03:34. Current memory use 40MB.
... no workshops awaiting scheduled allocation. ... used 1 dbqueries
... used 0.31064915657043 seconds
Scheduled task complete: Background processing for scheduled allocation (workshopallocation_scheduled\task\cron_task)
Execute adhoc task: mod_cheve\task\send_to_ws
... started 03:03:34. Current memory use 40.1MB.
... used 1 dbqueries
... used 0.037688970565796 seconds
Adhoc task complete: mod_cheve\task\send_to_ws
Ran 1 adhoc tasks found at Sun, 27 Feb 2022 03:03:26 +0100
Cron script completed correctly
Cron completed at 03:03:35. Memory used 40.3MB.
Execution took 8.708572 seconds