fix(contribution): process all incomplete-unlock accounts in backfill (remove 100-limit)

Previous 100-account batch caused starvation: accounts at positions 101+
(including recent pre-planting users) were never processed. Remove limit
to process all eligible accounts in each 10-minute run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-03 21:55:46 -08:00
parent 551723fe82
commit 2565fa8259
2 changed files with 2 additions and 4 deletions

View File

@ -302,7 +302,7 @@ export class ContributionScheduler implements OnModuleInit {
this.logger.log('Starting contribution backfill scan...'); this.logger.log('Starting contribution backfill scan...');
// 查找解锁状态不完整的账户(已认种但层级<15或奖励档位<3 // 查找解锁状态不完整的账户(已认种但层级<15或奖励档位<3
const accounts = await this.contributionAccountRepository.findAccountsWithIncompleteUnlock(100); const accounts = await this.contributionAccountRepository.findAccountsWithIncompleteUnlock();
if (accounts.length === 0) { if (accounts.length === 0) {
this.logger.debug('No accounts with incomplete unlock status found'); this.logger.debug('No accounts with incomplete unlock status found');

View File

@ -239,7 +239,7 @@ export class ContributionAccountRepository implements IContributionAccountReposi
* @param limit * @param limit
* @returns * @returns
*/ */
async findAccountsWithIncompleteUnlock(limit: number = 100): Promise<ContributionAccountAggregate[]> { async findAccountsWithIncompleteUnlock(): Promise<ContributionAccountAggregate[]> {
// 查找已认种但未达到满解锁状态的账户: // 查找已认种但未达到满解锁状态的账户:
// - unlockedLevelDepth < 15 或 // - unlockedLevelDepth < 15 或
// - unlockedBonusTiers < 3 // - unlockedBonusTiers < 3
@ -251,8 +251,6 @@ export class ContributionAccountRepository implements IContributionAccountReposi
{ unlockedBonusTiers: { lt: 3 } }, { unlockedBonusTiers: { lt: 3 } },
], ],
}, },
orderBy: { updatedAt: 'asc' }, // 优先处理最久未更新的
take: limit,
}); });
return records.map((r) => this.toDomain(r)); return records.map((r) => this.toDomain(r));