Skip to content
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

[Woo POS] POS avalability check optimisation #12759

Conversation

kidinov
Copy link
Contributor

@kidinov kidinov commented Oct 3, 2024

Closes: #12633

Description

Currently, there are two slow tasks we run to determine POS availability:

  • Onboarding status check: takes ~3300ms or ~0 if cached. It should be cached for those who use IPP or POS regularly
  • Payment account info check: takes ~1100ms - just slow back-end; we probably can not do anything on our side regarding this
    Those are run in sequential order, so in the worst-case scenario, it takes 4400ms to determine if POS is available.

The PR changes to run the heavy tasks in parallel, reducing the time in the case scenario to ~3300

Testing information

Open more -> Notice faster determination of the POS availability

The tests that have been performed

^

Images/gif

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if 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:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@kidinov kidinov added the feature: point of sale POS project label Oct 3, 2024
@kidinov kidinov added this to the 20.9 milestone Oct 3, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 3, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitef8b773
Direct Downloadwoocommerce-wear-prototype-build-pr12759-ef8b773.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 3, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitef8b773
Direct Downloadwoocommerce-prototype-build-pr12759-ef8b773.apk

@kidinov kidinov requested a review from samiuelson October 4, 2024 09:14
@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 40.86%. Comparing base (5a9dbdd) to head (ef8b773).
Report is 6 commits behind head on trunk.

Files with missing lines Patch % Lines
...m/woocommerce/android/ui/woopos/WooPosIsEnabled.kt 85.71% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #12759   +/-   ##
=========================================
  Coverage     40.86%   40.86%           
+ Complexity     5757     5751    -6     
=========================================
  Files          1236     1236           
  Lines         69722    69726    +4     
  Branches       9668     9669    +1     
=========================================
+ Hits          28490    28496    +6     
+ Misses        38604    38602    -2     
  Partials       2628     2628           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@samiuelson samiuelson self-assigned this Oct 14, 2024
Copy link
Collaborator

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit: Thanks for optimizing this, nice idea, and the difference is visible.

@samiuelson samiuelson enabled auto-merge October 14, 2024 15:42
@samiuelson samiuelson merged commit 4592e2d into trunk Oct 14, 2024
15 checks passed
@samiuelson samiuelson deleted the 12633-woo-pos-determination-if-pos-available-takes-more-time-than-it-should branch October 14, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Woo POS] Determination if POS available takes more time than it should
4 participants