-
Notifications
You must be signed in to change notification settings - Fork 47
WooCommerce checkout causes 6 calls to VarnishPurger->purge_post per cart item #69
Comments
I looked into it and WooCommerce only triggers the purge_post and consequently the @Ipstenu But I think I've came up with an idea based on how it is outlined in #5 (comment). This would also fix #65. The idea is as follows: Have a What you think? I'd be happy to add a PR if that's the way to go? ...10 min later... :) Hmm, looking through the code it seems like it already uses varnish-http-purge/varnish-http-purge.php Line 170 in b2c1364
But I do not understand how this can work to accumulate (merge) the incoming URLs into it. The code just seems to assign the new value each time but not to varnish-http-purge/varnish-http-purge.php Line 844 in b2c1364
So I guess only for the last round the purges are executed (that is the last item/product in the cart) because Also, not sure but I think that the variable should be varnish-http-purge/varnish-http-purge.php Line 42 in b2c1364
|
Side note: Interestingly I just saw now that |
I can't figure out why it's calling it 6 times for you, since I can't reproduce that EXCEPT on a site where I've heavily integrated multiple post types. So saving one type triggers a save on another page, which causes it to be called twice. But that's it. |
This is a spin-off of #63.
This "bug" applies to simple as well as variable products. This happens whenever an item has a restricted stock / inventory (see https://docs.woocommerce.com/document/managing-products/#section-6 and look for "stock management"), so they you sell physical goods (coffee, T-Shirts) then whenever an item is sold, then the inventory is reduced by that number. This causes to post to be saved.
Not sure why this happens but for every item in a cart the purge functionality (VarnishPurger->purge_post) is called 6 times. So when someone has an order of say 5 products, then it would be called
6 x 5 = 30 times
. Each time for the$urls
the purge response is done. It's about 20 URLs each time. This makes30 x 20 = 600
purge requests in each checkout.On our server the varnish backend is nearby, that is, a response is about 50-100ms. Still this makes
50-100ms x 600 requests = 30000-60000ms
, that is 30 to 60 seconds delay just because of the varnish http purge plugin :-(The text was updated successfully, but these errors were encountered: