-
Notifications
You must be signed in to change notification settings - Fork 136
[Product AI] Make requests in parallel when saving the product #12770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Product AI] Make requests in parallel when saving the product #12770
Conversation
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #12770 +/- ##
============================================
- Coverage 40.86% 40.84% -0.02%
+ Complexity 5757 5752 -5
============================================
Files 1236 1236
Lines 69722 69738 +16
Branches 9668 9673 +5
============================================
- Hits 28490 28486 -4
- Misses 38604 38624 +20
Partials 2628 2628 ☔ View full report in Codecov by Sentry. |
JorgeMucientes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @hichamboushaba code changes look great and everything is still working as expected. I didn't notice such a big improvement in the the time taken to save the product as you experienced on your site, but still I could see like 2-3 secs improvement on my tests. In any case the changes make sense and code is cleaner and more optimized now.
| } | ||
|
|
||
| is AiProductSaveResult.Failure -> { | ||
| // Keep track of the uploaded image to avoid re-uploading it on retry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 💯
Closes: #12664
Description
This PR updates the logic of saving the AI generated product as draft to make the preparation requests in parallel, this should speed up the process, and it's how iOS is handling it.
To make the upload request also in parallel, I moved it to the usecase
SaveAiGeneratedProduct, which required some changes to the ViewModel too.From my tests, with this change, the saving (including image upload) was reduced from 12 seconds to 7 seconds in my test website.
Steps to reproduce
Testing information
The tests that have been performed
^
Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: