Skip to content

Commit 74f1cce

Browse files
committed
improve(cli): reset currentScope per contract; guard finalizing status on zero contracts
Address Gemini review on #171: - reset this.currentScope at the start of each contract so the progress line doesn't show the previous contract's last scope until the first fetch lands. - guard the 'finalizing database writes...' status behind totalContracts > 0 so a zero-contract run (no validated token contracts) shows 'initializing...' instead of 0 >= 0 reading as finalized.
1 parent c6b4797 commit 74f1cce

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/cli/sync-modules/sync-accounts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export class AccountSynchronizer extends Synchronizer<IAccount> {
111111
this.currentContract = contract;
112112
this.currentContractIndex = i;
113113
this.currentContractScopes = 0;
114+
this.currentScope = '';
114115
console.log(`[DEBUG] Starting contract ${i + 1}/${this.tokenContracts.length}: ${contract}`);
115116

116117
let lowerBound: string = '';
@@ -194,7 +195,7 @@ export class AccountSynchronizer extends Synchronizer<IAccount> {
194195
const progressPercent = this.totalContracts > 0 ? ((this.completedContracts / this.totalContracts) * 100).toFixed(1) : '0.0';
195196

196197
let statusMessage: string;
197-
if (this.completedContracts >= this.totalContracts) {
198+
if (this.totalContracts > 0 && this.completedContracts >= this.totalContracts) {
198199
statusMessage = 'finalizing database writes...';
199200
} else if (this.currentContract) {
200201
// currentContractIndex is 0-based and set when a contract starts, so +1 reflects the contract in progress

0 commit comments

Comments
 (0)