Appointments plus quicker refresh with GCal

Hello,

I am integrating Gcal with A+. I noticed that it only refreshed Appointments made with Gcal every 10 minutes. Is there a way to change that to every 1 minute? Alernatively, is there something that can be done that would "push" the new appointment to A+ when a new appointment is made? I saw this link in the settings that i would like to automate some how when an appointment is made in Gcal.

Import and Update Events Now
Clicking this link will manually import and update your Events from the selected calendar without waiting for 10 minutes. Note: Maximum 500 future events that will start until appointment limit setting are imported in the order of their starting time. Past events and all day events are not imported.

  • Vaughan
    • Support/SLS MockingJay

    Hi @dcayme1,

    This works on the cron I believe, and is dependant on how busy your site is, the more people that visit and load the pages on your site, the more often the cron will fire. But google can limit your account if they receive too many requests in a short space of time which is why 10 mins is the default.

    You can try setting up a manual cronjob in your server instead.

    These articles should help you if you wish to try that.

    http://www.lucasrolff.com/wordpress/why-wp-cron-sucks/

    https://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-replace-wordpress-cron-with-a-real-cron-job

    Hope this helps

  • dcayme1
    • Site Builder, Child of Zeus

    Hello,

    I tried setting up a manual cronjob per your directions above. I set it up to update every minute. I timed it and it took over 5 minutes for it to update. Can you please confirm that the Cron Job is what is handling this? Is there something else i need to update?

    In looking at the scrypt for the buton to " import and update events now", it says:

    Import and Update Events Now

    not sure if that helps show anything.

    Thanks for the help
    -Dom

  • dcayme1
    • Site Builder, Child of Zeus

    Hello,

    I also got the following status email regarding my Cron:

    Subject line:
    Cron <nawatmas@box422> wget -q -O - http://nawatmassagetherapy.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

    Contents:
    Can't exec "/bin/bash": No such file or directory at /usr/sec/bin/setupfake line 348.
    shell failed at /usr/sec/bin/setupfake line 348.

    Since my Cron Job failed and my appointment was still updated, Could it be that the Cron is not what is handling this process? Please let me know if that helps troubleshoot the issue?

    -Dom

  • Jack Kitterhing
    • Code Norris

    Hi there @dcayme1,

    Hope you're well today and thanks for your questions! :slight_smile:

    We use the wp_cron to import and export using Gcal integration, you could use the define

    define('ALTERNATE_WP_CRON', true);

    Which will run it more often as needed when you load a page at the time a cron executes, rather than requiring low amounts of front-end traffic like normal.

    You could also install https://wordpress.org/plugins/wp-crontrol/ to check that your wp_cron is correctly running, we're here to help. :slight_smile:

    Thanks!

    Kind Regards
    Jack.

  • dcayme1
    • Site Builder, Child of Zeus

    Hello,

    Thank you for your input. i tried posting your above code in the wp-config.php. It didn't do anything. I would like to confirm that A+ uses cron? in looking at appontments.php, the only mention of cron says:

    // Since wp-cron is not reliable, use this instead

    add_option( "app_last_update", time() );

    Also, i installed wp crontrol. I do not see anything with a 10 minute timeframe or that reference appointments plus. the only once close to 10 minutes are the following whch are for memberships plugin:

    membership_communications_process run every 5 min
    membership_perform_cron_processes_quarterhourly run every 15 min.

    Please confirm that A+ uses cron to sync as i cannot get gcal to sync to A+in shorter than 10min. From A+ to gcal however it is basically instantaneous.

    -Dom

  • Jack Kitterhing
    • Code Norris

    Hi there Dom,

    Hope you're well today! After further investigation, I can confirm it doesn't use wp_cron, sorry about the confusion there.

    Instead it uses it's own custom option, line 4308 of appointments.php you'll see this code

    //  Run this code not before 10 mins
    		if ( ( time( ) - get_option( "app_last_update" ) ) < apply_filters( 'app_update_time', 600 ) )
    			return;
    		$this->remove_appointments();
    		$this->send_reminder();
    		$this->send_reminder_worker();
    		// Update Google API imports
    		if ( is_object( $this->gcal_api ) )
    			$this->gcal_api->import_and_update();
    	}

    The first part

    if ( ( time( ) - get_option( "app_last_update" ) ) < apply_filters( 'app_update_time', 600 ) )

    Is where it sets the plugin to check every 10 minutes (600 seconds).

    You can use the filter (app_update_time) with a custom function, or directly modify the time there, please note any modifications made to the plugin will be overwritten on a update.

    Thanks!

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.