feat(api): refresh Riot ID by PUUID
This commit is contained in:
1 parent
79534cf43c
commit
9cd5850d43
6 files changed
+508
-3
No files matched your search
@@ -156,6 +156,7 @@ export class RiotJobWorkerService implements OnModuleInit, OnModuleDestroy {
|
||||
queueId,
|
||||
});
|
||||
}
|
||||
await this.refreshRiotIdentity(job);
|
||||
await this.refreshLeagueEntries(job);
|
||||
await this.markUserFetchedAt(job);
|
||||
const event = await this.jobQueueService.markCompleted(job);
|
||||
@@ -211,6 +212,26 @@ export class RiotJobWorkerService implements OnModuleInit, OnModuleDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
private async refreshRiotIdentity(job: RiotRefreshSubJob): Promise<void> {
|
||||
try {
|
||||
const result = await this.enrichmentService.refreshRiotIdentity({
|
||||
userId: new mongoose.Types.ObjectId(job.userId),
|
||||
puuid: job.puuid,
|
||||
region: job.region,
|
||||
});
|
||||
if (result !== 'failed') return;
|
||||
this.logger.warn(
|
||||
`Riot identity refresh failed ${job.jobId}: puuid=${job.puuid}`,
|
||||
);
|
||||
} catch (error) {
|
||||
this.logger.warn(
|
||||
`Riot identity refresh failed ${job.jobId}: ${
|
||||
error instanceof Error ? error.message : error
|
||||
}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private async refreshLeagueEntries(job: RiotRefreshSubJob): Promise<void> {
|
||||
try {
|
||||
const result = await this.enrichmentService.refreshLeagueEntries({
|
||||
|
||||
Reference in new issue
Block a user