Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
105 stars 20 forks source link

API Timeout being overriden to 60 + 10 seconds #2711

Open Juberstine opened 6 months ago

Juberstine commented 6 months ago

It appears the following code is setting some or possibly all timeouts for the WooCommerce and the WC API to (60 + 10) seconds:

https://github.com/Automattic/woocommerce-services/blob/trunk/classes/class-wc-connect-api-client.php#L442

https://github.com/Automattic/woocommerce-services/blob/trunk/classes/class-wc-connect-api-client-live.php#L49

This is impacting in my case the Printful sync. When I manually edited these settings via the raw code from 60 to 280, my timeouts went away and I confirmed the API requests were able to pass the previous 70 second limit, where before they were timing out at 70 seconds.

Can the plugin not just respect the native php timeout? why set a separate one?

Juberstine commented 6 months ago

Post change, you can also see the WooCommerce Status page shows (280 +10) that I see:

Screenshot 2024-01-01 190717

Steps to replicate. Install WooCommerce and this plugin. Verify the php timeout has decreased from whatever PHP info.php says to 70, which the plugin overrides to.

Juberstine commented 6 months ago

I tested a second site and could not replicate. This may only happen if the site is in a sync failure state:

01-01-2024 @ 19:18:42 - wcc_server_error_response Error: The WooCommerce Shipping & Tax server returned: Bad Request child "settings" fails because [child "dimension_unit" fails because ["dimension_unit" must be one of [mm, cm, m, km, in, yd, ft, mi, miles, kms]]] ( 400 ) (fetch_service_schemas_from_connect_server)

I fixed that error on the primary site and the issue went away. I'll leave this report just to get looked at but this may be a super edge case