[Slow performance] - two seconds for each call
Hi, In my tests, each wcapi call takes about 2 seconds, regardless of the content of the call. If I do a get of a single product or a get of 100 products, it always takes about 2 seconds.
Two seconds for an operation on 100 products can be an acceptable time, however it is far too long for an operation on only one product.
The fact that the long execution time does not depend on the type of call, makes me rule out a problem on my server, and makes me think that most of the time is used to "establish the connection" and not to "execute the query".
Can i do something to speed up the process?
Thanks
I am too having the same problem. Have anyone found a solution to this?
Same problem here :
[2022-04-11 18:07:06,549] - [DEBUG] - Starting new HTTPS connection (1): blabla.co:443
[2022-04-11 18:07:08,123] - [DEBUG] - https://blabla.co:443 "GET /wp-json/wc/v3/products?&page=2&per_page=100 HTTP/1.1" 200 None
[2022-04-11 18:07:08,232] - [DEBUG] - Starting new HTTPS connection (1): blabla.co:443
[2022-04-11 18:07:09,743] - [DEBUG] - https://blabla.co:443 "GET /wp-json/wc/v3/products?&page=3&per_page=100 HTTP/1.1" 200 None
It's because of the handshake at each request. I don't know if there is a solution for this.
For the requests package there is a session() parameter, so the handshake is done once. I don't find the same thing for wc-api.
I hope @claudiosanches will check this to add requests.session() in api.py for faster performance
some news regarding this feature? related to https://github.com/woocommerce/woocommerce/issues/26029#issuecomment-1197084730 ??? probably
some news regarding this feature? related to woocommerce/woocommerce#26029 (comment) ??? probably
I don't think the related issue is the same problem as this issue. This issue seems to be a session issue in the wc-api-python code. The handshake is made for each request and not only once.
The related issue seems to be related to woocommerce API directly and not to the python package.
But I would love to hear from the developer on this issue.
If you are still looking for a solution, since the repo is not maintained, I have forked the project to add the Session + Retry here : https://github.com/chichi13/wc-api-python-unofficial
If you are still looking for a solution, since the repo is not maintained, I have forked the project to add the Session + Retry here : https://github.com/chichi13/wc-api-python-unofficial
LOL. Timing. I just raised a trivial PR for this. Your branch adds retry, and updates deps and more, so enhances this library even further. Thanks.