admin管理员组文章数量:1323023
I´m testing my cron task. I´m not sure but it seems to be the effect of a previous code. So, I´m wondering when you modify you call function and you run now your cron task (I´m using WP Control) and you load a page, the code applied is not the most recent code you upload. It´s right or wrong ? What happens excalty, call functions are cached ?
I´m testing my cron task. I´m not sure but it seems to be the effect of a previous code. So, I´m wondering when you modify you call function and you run now your cron task (I´m using WP Control) and you load a page, the code applied is not the most recent code you upload. It´s right or wrong ? What happens excalty, call functions are cached ?
Share Improve this question asked Sep 18, 2020 at 13:50 J.BizMaiJ.BizMai 9002 gold badges10 silver badges30 bronze badges 2- 2 When you schedule an event, the function that is run is the function as it is when it is run, not when it was scheduled. There’s no caching of the function when the event is scheduled. Is that what you’re asking? – Jacob Peattie Commented Sep 18, 2020 at 14:11
- @JacobPeattie, yes, thank you. I wanted to confirm that. – J.BizMai Commented Sep 18, 2020 at 14:41
1 Answer
Reset to default 0What happens excalty, call functions are cached ?
They do not get cached.
When you schedule a cron job, it stores a record in the database to trigger a hook with certain parameters at a time/date. No code is cached.
So when that time comes, the code is loaded and run from the disk as it is at that time, not when it was scheduled.
For example, if I schedule a cron job for tomorrow that writes the word "hello" to a file, then immediately change the function to instead send an email, when the cron job runs an email is sent.
本文标签: testingIs there a delay to include call function modification in a scheduled cron task
版权声明:本文标题:testing - Is there a delay to include call function modification in a scheduled cron task? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742111801a2421290.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论