User tests: Successful: Unsuccessful:
Pull Request for Issue joomla-projects/soc21_website-cronjob#59
Pinging @ditsuke and @bembelimen since Scheduled Tasks is their baby and they're currently the only ones who can understand this PR.
Scheduled tasks can now return Status::WILL_RESUME
to indicate they are not done and should be rescheduled immediately to resume execution.
This is useful for whenever you have long running tasks which would otherwise end up hitting a memory or timeout limit on your server. Some examples of such tasks:
The “Task - Demo Tasks!” plugin has been updated with a new sample task called “Resumable task”.
Create a new task using Resumable Task.
Set it to run once every 10 minutes.
Enable Individual Task Logs and set the Log Filename to resumable.log.php
.
Trigger the task scheduler. On each execution, the task has a 60% chance of resuming and 40% chance of finishing.
N/A — Joomla did not support resumable tasks.
The administrator/logs/resumable.log.php
file will contain something like this:
2022-01-16 13:21:15 INFO Running task#01 'Resumable Example'.
2022-01-16 13:21:15 INFO Task> Starting new task 1
2022-01-16 13:21:15 INFO Task> Starting 1s timeout
2022-01-16 13:21:16 INFO Task> 1s timeout over!
2022-01-16 13:21:16 INFO Task> Task 1 will resume
2022-01-16 13:21:16 INFO Task#01 needs to perform more work.
2022-01-16 13:21:23 INFO Running task#01 'Resumable Example'.
2022-01-16 13:21:23 INFO Task> Resuming task 1
2022-01-16 13:21:23 INFO Task> Starting 1s timeout
2022-01-16 13:21:24 INFO Task> 1s timeout over!
2022-01-16 13:21:24 INFO Task> Task 1 is now complete
2022-01-16 13:21:24 INFO Successfully finished task#01 in 1.00 (net 1.00) seconds.
As you can see the task can detect whether it's being resumed.
N/A. There is no documentation on scheduled tasks beyond the demo tasks plugin. The new resumable demo task is self–documenting.
I have still not managed to find time to integrate scheduled tasks in my own software. I did have, however, the time to study the code and understand better how Scheduled Tasks work. I can already see that they are very appealing. I am looking forward to implementing an integration with them in the next minor versions of my software tentatively scheduled for early Q2 2022. If lazy scheduling works in real world sites as reliably as it does on my test servers it will be a veritable game changer for Joomla!. That's the first time in years I am ecstatic about new code added to Joomla, let alone code added in a minor release. Well done!
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings Libraries Front End Plugins |
Labels |
Added:
Language Change
?
|
@tecpromotion Cheers! And thank you ever so much for the test!
@brianteeman Thank you for the comment language fixes :)
@nikosdion I've allowed myself to apply the change suggestion for "impending".
I've also restored the previous test result because all changes after that were only in code comments.
@nikosdion Ah, and I was so free to remove the emoji from the PR description. We made bad experience with that in past.
I have tested this item
@richard67 Can I ask an incidental question? You said “[...] remove the emoji from the PR description. We made bad experience with that in past”. Um... What kind of bad experience? I have used Emojis before. It sounds like there's a story to be told here. What have I missed?
@richard67 Can I ask an incidental question? You said “[...] remove the emoji from the PR description. We made bad experience with that in past”. Um... What kind of bad experience? I have used Emojis before. It sounds like there's a story to be told here. What have I missed?
In past sometimes emojis in the title or the first so and so many characters ot the description was able to confuse the issue tracker, as far as I remember, and it also could cause Drone or Appveyor not being started, something like that.
I saw that Drone had not been started long time after the last commit, so I removed the emoji to be safe.
I have tested this item
Dang! I would have never thought an emoji would throw a spanner in the works like that. Thanks for the heads up. I'll just use text smileys from now on.
Restored @tecpromotion 's test result since the changes after that were just doc bloc and reverting an unrelated change (which I just have tested).
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-01-17 20:41:09 |
Closed_By | ⇒ | bembelimen | |
Labels |
Added:
?
|
Awesome, thx
I have tested this item✅ successfully on b7d170b
Thanks @nikosdion
Nice feature
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36708.