joomla-projects / soc21_website-cronjob

GNU General Public License v2.0
5 stars 3 forks source link

Implement AJAX behavior for lazy scheduling #25

Closed ditsuke closed 2 years ago

ditsuke commented 2 years ago

Pull Request for Issue #19.

Summary of Changes

Implements lazy scheduling behavior supported by com_ajax backed AJAX requests instead of being executed at the end of each regular response. The JavaScript is injected into all site site responses with an HTML context. This change entirely removes the shutdown_function behavior in favor of this new method. The scheduler will still be trigger-able by regular requests to a site endpoint ending with parameters ?option=com_ajax&plugin=runScheduler&group=system&format=raw&scheduler_hash=xyz, where the scheduler_hash parameter is only needed if the Scheduler is protected with a hash. I think this should be documented somewhere in the Scheduler backend interface, probably in on the configuration form.

Tasks

Testing Instructions

Load a regular page on site. Performance should not be impacted visually or otherwise even with long running scheduled tasks. This should be verified with the log from joomla_scheduler.php.

Actual result BEFORE applying this Pull Request

Scheduler is triggered at the end of each site response. This should be apparent especially with long running tasks which will cause the browser to indicate an ongoing load.

Expected result AFTER applying this Pull Request

Scheduler is now triggered by AJAX calls from the browser at a regular interval. This is 5 minutes at the moment.

Documentation Changes Required