admin管理员组文章数量:1426280
I am running background job by using add_action hook, hook starts on REST API CALL:
if ( ! wp_next_scheduled( 'bg_job_hook' ) ) {
wp_schedule_single_event( time(), 'bg_job_hook');
get_headers(get_site_url());
}
add_action( 'bg_job_hook', array( $this->$bg, 'do_background' ) );
it works fine, but I would to quit this job, so on another api call I add an option, and inside background job I get this option on every loop. I see that this quit option is updated in DB, but logs from loop shows me that not. If iteration quits, and I will background job again, it will after first loop because get_option shows true..
Why during loop it is not working ?
I am running background job by using add_action hook, hook starts on REST API CALL:
if ( ! wp_next_scheduled( 'bg_job_hook' ) ) {
wp_schedule_single_event( time(), 'bg_job_hook');
get_headers(get_site_url());
}
add_action( 'bg_job_hook', array( $this->$bg, 'do_background' ) );
it works fine, but I would to quit this job, so on another api call I add an option, and inside background job I get this option on every loop. I see that this quit option is updated in DB, but logs from loop shows me that not. If iteration quits, and I will background job again, it will after first loop because get_option shows true..
Why during loop it is not working ?
Share Improve this question asked May 18, 2019 at 18:40 FrancMoFrancMo 1537 bronze badges1 Answer
Reset to default 0Ok for some reason caching works strange in WP :) So I resigned from using get_option, and I am doing pure SQL query to DB, and everything works fine.
本文标签: pluginsForce quit running background job
版权声明:本文标题:plugins - Force quit running background job 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745473799a2659867.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论