Support » Plugin: Facebook for WooCommerce » Cron job abusive

  • Zarausto


    Hey WordPress, imagine a store with more than 2k products, Facebook makes a cron job (wc_facebook_background_product_sync_cron_interval ) to sync, god knows how many, products every 5 minutes!

    It’s killing CPU on server!!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support simonskyverge


    Heye @zarausto,

    Thanks for taking the time to leave a review, we greatly appreciate it!

    The cron job you’ve seen is part of our background process health check to make sure the system is syncing products correctly. Every 5 minutes it will check the queue to see if there are any in-progress sync attempts and make sure they fully complete. The majority of the time there will be no products in the queue for syncing unless you’ve explicitly started a full manual sync, and so the corn interval action runs without using much processing power at all.

    With a longer cron interval, the background process sync task could become stuck due to the server resources available. We rely on background processing to take advantage of the performance benefits this gives us, rather than a manual batch action that would interrupt your navigation of the site, possibly resulting in timeouts with a lot of products.

    If you’re seeing this process kill your server, I do apologize for this! We’ve stress-tested the plugin in development, and have had merchants sync up to 20,000 products so far without huge issues that I know of. If you’d like to open a support request to look into this further and to provide some extra detail about the resource usage your seeing, we’d be happy to help!

    I understand if you’d rather not though, and thanks for leaving the review all the same! We really appreciate all the feedback for the plugin so we can help make it better for everyone.



    Thread Starter Zarausto


    I’m sorry Simon, as you can see in our New Relic report Facebook Plugin Keeps using lots and lots of CPU:

    This is very upseting beacuse our client needs this.

    WordPress/Automatic Team should do something about it. It’s killing Woocommerce perfomance and generating lots of waste of power.

    Plugin Support simonskyverge


    Hi @zarausto,

    Thanks for the feedback! The New Relic image in your last reply seems to be regarding a different scheduled action, the wc_facebook_regenerate_feed rather than wc_facebook_background_product_sync_cron_interval, is that right?

    In the previous versions of the plugin, we had to remove API access to sync products due to a security issue with token access. The only way that products were synced was to generate a feed file that Facebook would request from the site on a schedule, once per hour. In order to guarantee that the information synced was most up to date, we had to regenerate the feed file on a schedule too, every 15 minutes.

    With the API access now restored in our latest versions, this has become less important though still useful for a few edge-cases. Ultimately I hope we can move away from this in the future though, and it’s something our product and development team are already looking into.

    That said, if this is causing a significant impact on your customer’s sites, it is possible to adjust the interval that the feed file is regenerated.

    * Filters the frequency with which the product feed data is generated.
    * @since 1.11.0
    * @param int $interval the frequency with which the product feed data is generated, in seconds. Defaults to every 15 minutes.
    $interval = apply_filters( 'wc_facebook_feed_generation_interval', MINUTE_IN_SECONDS * 15 );

    You would first need to disable product syncing to remove the existing schedule. Then insert the custom code adjusting the returned interval from above, then re-enable product syncing for the new interval to be used.

    Thanks again for taking the time to leave ar review, and I hope we can look at this closer in the future! In the meantime, I hope this might prove useful for your customer’s sites.



Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this review.