-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Task Scheduler Like Cron job #154
Comments
The Cron job has the two key components.
Should we implement these all components? |
You also mention about the cross platform. I am not familiar with the cron job task on Windows. I also am familiar with cron job on Linux. |
Yes should implemented all components. in windows there is Task Scheduler when you send your proposal as a pull request i will add Win task scheduler support write in such a way it has option to add support for windows |
@lablnet, when I think this deeply, I found the following way to do Cron job package to support cross platform.
|
@peter279k Yes but this approach has few drawbacks Using the scheduler.php to let this program run on every minute First if any developer want to set schedule to set for 30 seconds then what result expected? Also i think this make framework slightly slower How can we execute The approach i think
namespace Zest\Scheduler;
class Scheduler
{
public function __construct()
{
$this->scheduler = php_os() === 'win' ? new Schedule() : new Cron();
}
} What do you think? |
It looks good, but we don't want to let developer set less than one minute
on cron job.
I think it is fine to use the following code you mention.
Muhammad Umer Farooq <[email protected]> 於 2019年3月24日 週日 下午5:43 寫道:
… @peter279k <https://github.com/peter279k> Yes but this approach has few
drawbacks
*Using the scheduler.php to let this program run on every minute*
First if any developer want to set schedule to set for 30 seconds then
what result expected?
Also i think this make framework slightly slower
How can we execute scheduler.php on every mints, without task scheduler
or cron?
The approach i think
there should be four files
- AbstractScheduler.php => expression parser
- Cron.php => Crons commands {extend AbstractScheduler}
- Schedule.php => Task Scheduler {extend AbstractScheduler}
- Scheduler.php => Scheduler which use {Cron or Schedule}
we can do following in Scheduler,php
namespace Zest\Scheduler;class Scheduler{ public function __construct() { $this->scheduler = php_os() === 'win' ? new Schedule() : new Cron(); }}
What do you think?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#154 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AImpMwJAPY4En_l_cg-3xQJoHe7gBDQoks5vZ0i4gaJpZM4bdx3m>
.
|
Sure, so we can start before started actual development it good to write the interface name should same as class |
@lablnet, consider following code: $jobs = [
[new CronExpression('cron job time'), new TaskName()],
[new CronExpression('cron job time'), new TaskName()],
];
$scheduler = new Schedule($jobs);
$scheduler->run(); And let the What do you think about that? |
Yes you are right but instead of saying |
There should be package that allow to handle task scheduler / cron job cross platform
The text was updated successfully, but these errors were encountered: