-
Notifications
You must be signed in to change notification settings - Fork 22
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
Initialisation is slow #9
Comments
Actually this behaviour was intentional, because the library tries to avoid the situation where asynchronous calls would be silently lost just because the PHP CLI executable could not be found. Anyway you're right about the performance cost and I realize I've never hit it, precisely because I instanciate the class only when needed: if (preg_match('/^\/cron/',$f3->PATH)) {
$f3->DEBUG=2;
$f3->ONERROR=function($f3){
KS\Report::instance()->send();
exit(1);
};
$f3->config('apps/cron.ini');
Cron::instance();
} So I've added an optional $cron->binary('/path/to/php',TRUE); or in config file: [CRON]
binary = /path/to/php, TRUE When this option is enabled, the validation check is bypassed. |
well thanks nice of cause that it checks the path automatically. But does it need to do that all the time, even if unsued? What about moving this part Lines 247 to 250 in 161da4d
into the execute method? |
Thanks for the insights. I'll refactor the library when I have a bit more time. I'll see if it's possible to guess the binary "just in time" and/or skip the asynchronicity directly in config file. |
[CRON]
binary = /path/to/php, TRUE When using this I get an
|
@xfra35 was this ever addressed? |
\Cron::instance();
is slow, because it always calls the binary method which uses an exec call:f3-cron/lib/cron.php
Lines 54 to 56 in a66f447
this cant be skipped, even if you'd set a valid path. Some measurements showed a bottleneck here:
Would love to see some way of avoiding this path check with each and every page load. For now I'm using this workaround:
This way it's only called when the cron service is really used. Maybe it could fit into its contruct as well 🤔
thx bro ;)
The text was updated successfully, but these errors were encountered: