Sunshine Session Garbage Collection runs on every page load
-
I am seeing reports for a client that the cronjob ‘sunshine_session_garbage_collection’ is being called on every page load.
Upon further inspection, the bug seems to be present in the following code:
/** * Register the garbage collector as a daily event. */ function sunshine_session_register_garbage_collection() { if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) { wp_schedule_event( current_time( 'timestamp' ), 'daily', 'sunshine_session_garbage_collection' ); } } add_action( 'wp', 'sunshine_session_register_garbage_collection' );
If you look closely, the handle for
wp_next_scheduled
(‘wp_session_garbage_collection’) is different from the actually scheduled handle (‘sunshine_session_garbage_collection’). Thus, this task will run on every page load, rather than just once a day.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Sunshine Session Garbage Collection runs on every page load’ is closed to new replies.