-
Notifications
You must be signed in to change notification settings - Fork 135
[Woo POS][Local Catalog][Bug] Invoke DB query on IO dispatcher
#14904
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
base: trunk
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR refactors WooPosIsLocalCatalogVariationsEndpointAvailable to execute on the IO dispatcher by making its invoke() function a suspend function and adding CoroutineDispatchers dependency. This ensures that version checking operations are performed on the appropriate background thread.
- Made
WooPosIsLocalCatalogVariationsEndpointAvailable.invoke()a suspend function with IO dispatcher context - Added
CoroutineDispatchersparameter to the class constructor - Updated test to provide test dispatchers when constructing the class
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| WooPosIsLocalCatalogVariationsEndpointAvailable.kt | Converted invoke function to suspend, added IO dispatcher wrapping, and injected CoroutineDispatchers dependency |
| WooPosIsLocalCatalogSupportedTest.kt | Updated test setup to provide testDispatchers to the WooPosIsLocalCatalogVariationsEndpointAvailable constructor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...oocommerce/android/ui/woopos/localcatalog/WooPosIsLocalCatalogVariationsEndpointAvailable.kt
Show resolved
Hide resolved
| import javax.inject.Inject | ||
|
|
||
| class WooPosIsLocalCatalogVariationsEndpointAvailable @Inject constructor( | ||
| private val getWooVersion: GetWooCorePluginCachedVersion, |
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.
getWooVersion internally queries DB on the main thread.
📲 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.
|
Description
This PR refactors
WooPosIsLocalCatalogVariationsEndpointAvailableto execute on the IO dispatcher by making itsinvoke()function a suspend function. This ensures that version checking operations are performed on the background thread, because internally they query the DB.💡 Don't merge until target is
trunkTest Steps
Images/gif
N/A
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.