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:
parent
551723fe82
commit
2565fa8259
|
|
@ -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');
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue