Skip to content

Commit f52c9cd

Browse files
committed
Rename recover stages to recoverRestUrlIfNeeded / recoverXmlRpcIfNeeded
The IfNeeded suffix makes the short-circuit (skip when the field is already present / not applicable) clear at the call site.
1 parent 85497da commit f52c9cd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

WordPress/src/main/java/org/wordpress/android/repositories/SiteProvisioningSource.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ class SiteProvisioningSource @Inject constructor(
143143
SiteAuthState.Provisioned -> coroutineScope {
144144
// Post-auth, the REST-capability chain and the XML-RPC recovery are independent —
145145
// each reads the site fresh and writes only its own column — so run them in
146-
// parallel. recoverRestUrl precedes detectCapabilities within its branch because
146+
// parallel. recoverRestUrlIfNeeded precedes detectCapabilities within its branch because
147147
// the probe needs the recovered REST root.
148-
val capabilities = async { recoverRestUrl(siteLocalId); detectCapabilities(siteLocalId) }
149-
val xmlRpc = async { recoverXmlRpc(siteLocalId) }
148+
val capabilities = async { recoverRestUrlIfNeeded(siteLocalId); detectCapabilities(siteLocalId) }
149+
val xmlRpc = async { recoverXmlRpcIfNeeded(siteLocalId) }
150150
xmlRpc.await()
151151
capabilities.await()
152152
}
@@ -199,7 +199,7 @@ class SiteProvisioningSource @Inject constructor(
199199
* Jetpack tunnel (which never runs discovery and leaves `wpApiRestUrl` null).
200200
* Persists the one column; the capability probe re-reads it.
201201
*/
202-
private suspend fun recoverRestUrl(siteLocalId: Int) {
202+
private suspend fun recoverRestUrlIfNeeded(siteLocalId: Int) {
203203
val site = siteStore.getSiteByLocalId(siteLocalId) ?: return
204204
if (!site.wpApiRestUrl.isNullOrEmpty()) return
205205
siteApiRestUrlRecoverer.discoverApiRootUrl(site.url)?.let { apiRootUrl ->
@@ -212,7 +212,7 @@ class SiteProvisioningSource @Inject constructor(
212212
* sites that don't have one. Discovers + authenticates against it, and on
213213
* success persists the one column; the application-password card re-reads it.
214214
*/
215-
private suspend fun recoverXmlRpc(siteLocalId: Int) {
215+
private suspend fun recoverXmlRpcIfNeeded(siteLocalId: Int) {
216216
val site = siteStore.getSiteByLocalId(siteLocalId) ?: return
217217
// WP.com / Atomic / Jetpack-WPCom-REST sites talk REST end-to-end and don't use XML-RPC.
218218
if (site.isUsingWpComRestApi || !site.xmlRpcUrl.isNullOrEmpty()) return

0 commit comments

Comments
 (0)