0

I'm using a cron to take data from Facebook and i have divided the job into three calls, to avoid making to many call all toghether, now how do i set up calls so that they don't overlap?

// Set the CRON for pages
wp_schedule_event(  current_time( 'timestamp' ), self::FB_CRON_FREQUENCY, self::FB_CRON_PAGES, array( Ai1ec_Facebook_Graph_Object_Collection::FB_PAGE ) );
// Set the CRON for groups
wp_schedule_event(  current_time( 'timestamp' ), self::FB_CRON_FREQUENCY, self::FB_CRON_GROUPS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_GROUP ) );
// Set the CRON for users
wp_schedule_event(  current_time( 'timestamp' ), self::FB_CRON_FREQUENCY, self::FB_CRON_USERS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_USER ) );

So i want all of the calls to run every two hours, but i want one to run at minute 15, one at minute 30 and one at minute 45 so that they do not overlap, how can i do that?

1 Answer 1

0

Ok that was pretty easy

// Set the CRON for pages
wp_schedule_event(  current_time( 'timestamp' ) + 450, self::FB_CRON_FREQUENCY, self::FB_CRON_PAGES, array( Ai1ec_Facebook_Graph_Object_Collection::FB_PAGE ) );
// Set the CRON for groups
wp_schedule_event(  current_time( 'timestamp' ) + 900, self::FB_CRON_FREQUENCY, self::FB_CRON_GROUPS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_GROUP ) );
// Set the CRON for users
wp_schedule_event(  current_time( 'timestamp' ) + 1350, self::FB_CRON_FREQUENCY, self::FB_CRON_USERS, array( Ai1ec_Facebook_Graph_Object_Collection::FB_USER ) );
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.