I'm programming the integration with external API (real estate). I have one CRON job which is planned for at 1 o'clock am. It's running very well because I'm using server CRON initialize instead WP CRON standard so It's running at the right time.
It's my scheduled job function:
function wcs_cron_system_update() {
wcs_cron_start_update();
$wcs_cron_actions = new WCS_Cron_Actions();
$wcs_cron_helpers = new WCS_Cron_Helpers();
$wcs_cron_actions->real_estate_cleaning();
$wcs_cron_helpers->remove_unused_images();
$wcs_cron_actions->investments_insert_sql();
$wcs_cron_actions->apartments_insert_sql();
$wcs_cron_actions->commerce_insert_sql();
$wcs_cron_actions->investments_insert();
$wcs_cron_actions->real_estate_insert();
$wcs_cron_actions->investment_update_by_single_real_easte();
$wcs_cron_actions->real_estate_update_by_single_investment();
$wcs_cron_actions->investment_update_by_all_real_easte();
$wcs_cron_actions->search_index_update();
}
I'm doing a few functions one by one because I need some data before I'm doing the next function. I can't schedule (I don't know how I should do it) separately CRON jobs because I had a few situations when some function was run before I have necessary data (because some functions were run before it should be)
My function contains a sequence of tasks (functions).
Question: is it the correct way to do it? maybe I should do it another way? how?
Thanks!
curl
orwget
command to trigger Cron via the URL, which would put an upper limit on the time it can run. Otherwise I do not believe this question can be answered, as there is no right/wrong way. You need to write a Q that can be answered with facts, if it runs and works for you then I do not see the problem. If you're looking to discuss architecture, this isn't a discussion forum