-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.1] poor man’s cron 3rd attempt #29592
Conversation
I am getting this in the joomla_web.php log: # #Fields: datetime priority clientip category message The CLI gives this: SchedulerScheduler started
joomla_cli.php log has this: # #Fields: datetime priority clientip category message My System - Job Scheduler plugin is showing Yes/No radio buttons, not a slider as in your screen grab. So has this mornings Nightly Build update not worked properly for me? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29592. |
@ceford most probably i've messed up something making the pr....let me check/re-check , and sorry for the extra work |
Update SQL script for adding the new table seems to be missing. |
@alikon Yes, seems I've missed them when checking on smartphone. But the insert statements into the extensions table are missing the meanwhile (since your last version of the PR) invented new column "locked". Could you check and if necessary correct? |
I have tested this item ✅ successfully on 1c1c740 Changed the frequency to 5 min on Job 3 to test the frequency cycle, and sleep time to 10 seconds, which is why the figures for Job>jobthree Task#3 is delayed compared to the other instances. Refreshed page a few times a few minutes apart. Log shown below.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29592. |
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
Co-authored-by: Tobias Zulauf <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. Now we have to get two tests so this can be finally merged.
I have just updated 4.1-dev with 4.0 and updated this PR acordingly so once drone is happy this can be fully tested :) |
the "Download — Prebuilt packages are available for download." is missing from the 4.1-dev pipeline ? |
I really like the idea of having a Cron fallback in the Joomla! and it's also a feature on the roadmap, so really thank you for bringing this code in. As we have still some time for Joomla! 4.1 I really would love to see to go a few steps further, so that we get a solution where the end user can manage crons over an interface and at the end the entries will be saved in a cron tab like way in the database. It would also be great if cron is available on the server there could be some integration. Last but not least probably we should also take care of the user executing the Cron. In the worse case it's a user who has not the privileges. (Thanks to @nibra and @HLeithner for a lot of valuable feedback here) tl;tr; I really like what you did but I think more is possible, would you be up to spend some more time and enhance your great start to bring it on the next level? |
of course, but what we have now in this pr is a good start..... the 1st step when and if this pr will be merged should be to use the poor man cron's for tasks like :
but i'll not spent more time on this, if this pr will not be merged (i've proposed this before 3.9 goes stable) p.s
|
if there is still someone interested i've decoupled it to be an external component https://github.com/alikon/testcom |
Would it be possible that you recover the branch for a few days, so I can copy it into my repository? I still like the base idea and implementation. |
The last iteration of #25022, porting #22310 to 4.x
Goal
a way to run scheduled "quick" tasks in approximately regular intervals
Summary of Changes
How it works
In a normal hosting situation that would be job for cron, but if your hosting doesn’t offer cron, then a common solution in these cases is “poor man’s cron:” on every page load (
onAfterRespond
) the scheduler system plugin check if itself is expected to run and then trigger a new eventonExecuteScheduledTask
then any job plugin wich listen to that event check if itself is expected to run and if so execute his task.Testing Instructions (web)
for test only
Frequency (in minutes) set = 0 mean run every (
onAfterRespond
)install these 2 silly job plugin:
plg_job_jobthree.zip
plg_job_jobone.zip
this one is an example on how to schedule an sql export
plg_job_jobexportdb.zip
job one simply sleep for 1 seconds
job two simply sleep for 3 seconds
set options, publish the plugin and save plugin ONE
Frequency (in unit) set 1
Unit of time set minute
means that this plugin run 1xminute = every minute
if
onExecuteScheduledTask
has been triggeredmaybe use different settings than ONE
Expected result
depending on your (plugins) settings
take a coffe/smoke/whatever 😄
randomly click a couple of frontend pages
check the log file at
yoursite/administrator/logs/joomla_web.php
you'll see something like this
1st run
the scheduler plugin (wich runs always frequency=0) trigger the
onExecuteScheduledTask
eventso plugin ONE and plugin TWO are executed (cause no previous run)
2nd run
the scheduler plugin (wich runs always frequency=0) trigger the
onExecuteScheduledTask
eventbut this time both plugin have an expected scheduled time (for example ONE each 1min TWO each 5min)
the 2nd run was at 17:24:47+00:00
the 1st run was at 17:24:43+00:00
they have only 4 seconds of difference form the previous execution so both plugin are not expected to run
3rd run
it depends on how fast you click & settings
Testing Instructions (webcron)
on scheduler system plugin
set Webcron to yes/enable
set Key to mywebcronactivationkey
then use
yoursiteurl/index.php?webcronkey=mywebcronactivationkey
as the url for webcron services to be triggredTesting Instructions (cli/cron)
Go to the cli folder of your website and run
php joomla.php job:run
check the log file at yoursite/administrator/logs/joomla_cli.php
php joomla.php job:list
php joomla.php job:run --help
Actual result
N/A
Additional comments
it can be used for tasks like:
Documentation Changes Required
yes