mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-05 07:43:49 +01:00
feat: more optimal fetching
This commit is contained in:
1 parent
c7021c5689
commit
f083c18dd0
2 files changed
+15
-17
No files matched your search
@@ -30,14 +30,5 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn
|
run: yarn
|
||||||
|
|
||||||
- name: Generate NA leaderboard
|
- name: Generate all leaderboards
|
||||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DISCORD_BLITZ_DB=${{ secrets.DISCORD_BLITZ_DB }} yarn publish:ratingleaderboard --region=na --target=latest --production
|
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DISCORD_BLITZ_DB=${{ secrets.DISCORD_BLITZ_DB }} yarn publish:ratingleaderboard --region=na,asia,eu --target=latest --production
|
||||||
if: always()
|
|
||||||
|
|
||||||
- name: Generate EU leaderboard
|
|
||||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DISCORD_BLITZ_DB=${{ secrets.DISCORD_BLITZ_DB }} yarn publish:ratingleaderboard --region=eu --target=latest --production
|
|
||||||
if: always()
|
|
||||||
|
|
||||||
- name: Generate Asia leaderboard
|
|
||||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DISCORD_BLITZ_DB=${{ secrets.DISCORD_BLITZ_DB }} yarn publish:ratingleaderboard --region=asia --target=latest --production
|
|
||||||
if: always()
|
|
||||||
@@ -30,14 +30,17 @@ const production = argv.includes('--production');
|
|||||||
const target = argv
|
const target = argv
|
||||||
.find((arg) => arg.startsWith('--target='))
|
.find((arg) => arg.startsWith('--target='))
|
||||||
?.split('=')[1] as 'midnight' | 'latest' | undefined;
|
?.split('=')[1] as 'midnight' | 'latest' | undefined;
|
||||||
const regionSubdomain = argv
|
const regionSubdomains = argv
|
||||||
.find((arg) => arg.startsWith('--region='))
|
.find((arg) => arg.startsWith('--region='))
|
||||||
?.split('=')[1] as RegionSubdomain | undefined;
|
?.split('=')[1];
|
||||||
|
|
||||||
if (!target) throw new Error('Target parameter not specified');
|
if (!target) throw new Error('Target parameter not specified');
|
||||||
if (!regionSubdomain) throw new Error('Region parameter not specified');
|
if (!regionSubdomains) throw new Error('Region parameter not specified');
|
||||||
|
|
||||||
const region = regionSubdomainToRegion(regionSubdomain);
|
regionSubdomains.split(',').forEach(async (regionSubdomain) => {
|
||||||
|
const region = regionSubdomainToRegion(regionSubdomain as RegionSubdomain);
|
||||||
|
|
||||||
|
console.log(`Building ${target} rating leaderboard for ${region}`);
|
||||||
|
|
||||||
const NEIGHBORS = 2 ** 8;
|
const NEIGHBORS = 2 ** 8;
|
||||||
const PLAYERS = await patientFetchJSON<RatingInfo>(
|
const PLAYERS = await patientFetchJSON<RatingInfo>(
|
||||||
@@ -134,7 +137,8 @@ for (const leaderboardChunk of chunk(leaderboard, 100)) {
|
|||||||
stats.forEach((stat, index) => {
|
stats.forEach((stat, index) => {
|
||||||
const trueIndex = chunkIndex * 100 + index;
|
const trueIndex = chunkIndex * 100 + index;
|
||||||
comprehensiveLeaderboard[trueIndex] =
|
comprehensiveLeaderboard[trueIndex] =
|
||||||
leaderboardChunk[index].id === 0 || stat?.statistics.rating === undefined
|
leaderboardChunk[index].id === 0 ||
|
||||||
|
stat?.statistics.rating === undefined
|
||||||
? {
|
? {
|
||||||
battles: 0,
|
battles: 0,
|
||||||
damage: 0,
|
damage: 0,
|
||||||
@@ -180,7 +184,9 @@ const changes: FileChange[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `regions/${normalizedServer}/rating/${info.current_season}/${target}.bkrl`,
|
path: `regions/${normalizedServer}/rating/${info.current_season}/${target}.bkrl`,
|
||||||
content: Buffer.from(leaderboardWriteStream.uint8Array).toString('base64'),
|
content: Buffer.from(leaderboardWriteStream.uint8Array).toString(
|
||||||
|
'base64',
|
||||||
|
),
|
||||||
encoding: 'base64',
|
encoding: 'base64',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -190,3 +196,4 @@ commitAssets(
|
|||||||
changes,
|
changes,
|
||||||
production,
|
production,
|
||||||
);
|
);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user