fix(deployment): implement countByOwner method and corresponding tests#2763
fix(deployment): implement countByOwner method and corresponding tests#2763
Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughThis change adds a new Changes
Sequence DiagramsequenceDiagram
actor Client
participant DRS as DeploymentReaderService
participant HTTP as DeploymentHttpService
participant LHS as LeaseHttpService
participant Repo as DeploymentRepository
participant DB as Database
Client->>DRS: listWithResources(owner, status, skip, limit)
Note over DRS: Setup Promise.all with 3 concurrent calls
par Lease Fetch
DRS->>LHS: getList(...)
LHS-->>DRS: leaseList
and Provider Fetch (if deployments exist)
DRS->>HTTP: getList(...)
HTTP-->>DRS: deploymentList
alt deploymentList is not empty
DRS->>HTTP: providers(...)
HTTP-->>DRS: providerList
end
and Count Fetch
DRS->>Repo: countByOwner(owner, status)
Repo->>DB: Deployment.count(where clause)
DB-->>Repo: count
Repo-->>DRS: count
end
DRS->>DRS: Map deployments with owner/dseq
DRS-->>Client: { deployments, count, leases, providers }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
|
I believe that requesting data from 1 source and pagination from another would cause another set of issues eventually. Switching entirely to the indexer is obviously not an option too due to performance issues. Why can't this be fixed on the rpc node? Have this been requested to @akash-network/core ? |
Why
The deployments table at stats.akash.network/addresses/{address}/deployments shows "Page 1 of 1" even when an address has many deployments. The Cosmos SDK node returns an incorrect pagination.total value equal
to the page size (e.g. "10") instead of the true total count, resulting in pageCount = ceil(10/10) = 1 and making pagination navigation impossible.
https://stats.akash.network/addresses/akash10lq8uyfl52d6t467qmd58e7jzl9ecmvet2m57p/deployments
What
Summary by CodeRabbit
Tests
Chores