mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-07-22 13:45:48 +00:00
fix: order chain queries by rowid so Pezkuwi's chains register first
SELECT * FROM chains had no ORDER BY - SQLite gives no ordering guarantee for that, so registration/connection order across ~98 chains was effectively unpredictable per run. The merged chains.json lists Pezkuwi's own chains first (wallet-utils' merge_chains()), and CollectionDiffer's findDiff()/Room's batch insert both preserve that order on first sync, so ordering by rowid (insertion order) makes Pezkuwi's own chains reliably register and start connecting first/early, instead of being interleaved unpredictably among ~90+ Nova-inherited chains where they could end up processed dead last - observed directly: a fresh install took 45+ seconds without a single Pezkuwi-related registration/connection attempt. No user should wait minutes for their own wallet's native chain to even start syncing after install, regardless of whether the eventual outcome is correct.
This commit is contained in:
@@ -164,7 +164,12 @@ abstract class ChainDao {
|
|||||||
|
|
||||||
// ------- Queries ------
|
// ------- Queries ------
|
||||||
|
|
||||||
@Query("SELECT * FROM chains")
|
// ORDER BY rowid: without an explicit order, SQLite gives no guarantee about row order for `SELECT *`.
|
||||||
|
// The merged chains.json lists Pezkuwi's own chains first (see wallet-utils' merge_chains()), and that
|
||||||
|
// order is what gets inserted first on initial sync - rowid tracks insertion order, so ordering by it
|
||||||
|
// means Pezkuwi's chains reliably register/connect first instead of being interleaved unpredictably
|
||||||
|
// among the ~90+ Nova-inherited chains, where they could otherwise end up processed last.
|
||||||
|
@Query("SELECT * FROM chains ORDER BY rowid")
|
||||||
@Transaction
|
@Transaction
|
||||||
abstract suspend fun getJoinChainInfo(): List<JoinedChainInfo>
|
abstract suspend fun getJoinChainInfo(): List<JoinedChainInfo>
|
||||||
|
|
||||||
@@ -172,7 +177,7 @@ abstract class ChainDao {
|
|||||||
@Transaction
|
@Transaction
|
||||||
abstract suspend fun getAllChainIds(): List<String>
|
abstract suspend fun getAllChainIds(): List<String>
|
||||||
|
|
||||||
@Query("SELECT * FROM chains")
|
@Query("SELECT * FROM chains ORDER BY rowid")
|
||||||
@Transaction
|
@Transaction
|
||||||
abstract fun joinChainInfoFlow(): Flow<List<JoinedChainInfo>>
|
abstract fun joinChainInfoFlow(): Flow<List<JoinedChainInfo>>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user