chore(env): rename test environment to staging

This commit is contained in:
dahyeon committed 2026-06-07 01:01:13 -07:00
1 parent d0d578b2b0
commit eadae789c8
17 files changed
+160 -107

No files matched your search

+17 -10
View File
@@ -28,7 +28,7 @@ const { MongoClient, ObjectId } = require("mongodb");
const CONFIG = {
MONGODB_URI: process.env.MONGODB_URI ?? "mongodb://127.0.0.1:27017",
LOLYMPUS_DB_NAME: process.env.LOLYMPUS_DB_NAME ?? "lolympus-test",
LOLYMPUS_DB_NAME: process.env.LOLYMPUS_DB_NAME ?? "lolympus-staging",
COMMUNITY_ID: new ObjectId(
process.env.COMMUNITY_ID ?? "69ebe0adf627c11be2f020a1",
),
@@ -137,14 +137,18 @@ async function fetchRiotJson({ host, path, query }) {
});
if (response.status === 429) {
const retryAfterSeconds = Number(response.headers.get("retry-after") ?? 1);
const retryAfterSeconds = Number(
response.headers.get("retry-after") ?? 1,
);
await sleep(Math.max(1, retryAfterSeconds) * 1000);
continue;
}
if (response.status === 404) return null;
if (!response.ok) {
const body = await response.text().catch(() => "");
throw new Error(`Riot API failed ${response.status} ${url.pathname}: ${body}`);
throw new Error(
`Riot API failed ${response.status} ${url.pathname}: ${body}`,
);
}
return response.json();
}
@@ -190,13 +194,14 @@ async function fetchRecentMatchIdsByPuuid(puuid) {
async function fetchRiotData({ riotId }) {
const fallback = splitRiotId(riotId);
const account =
(await fetchAccountByRiotId(fallback)) ?? {
...fallback,
puuid: normalizeString(INPUT.puuid),
};
const account = (await fetchAccountByRiotId(fallback)) ?? {
...fallback,
puuid: normalizeString(INPUT.puuid),
};
if (!account?.puuid) {
throw new Error(`Riot account not found and PUUID was not provided: ${riotId}`);
throw new Error(
`Riot account not found and PUUID was not provided: ${riotId}`,
);
}
const [summoner, leagueEntries, championMasteries, matchIds] =
@@ -280,7 +285,9 @@ function buildRiotAccount(riotData, now) {
summonerLevel: riotData.summoner?.summonerLevel ?? 0,
isPrimary: true,
tiers: riotData.leagueEntries.map((entry) => toTierInfo(entry, now)),
tierHistory: riotData.leagueEntries.map((entry) => toTierHistory(entry, now)),
tierHistory: riotData.leagueEntries.map((entry) =>
toTierHistory(entry, now),
),
matchIds: riotData.matchIds,
matchIdsFetchedAt: riotData.matchIds.length > 0 ? now : undefined,
championMasteries: riotData.championMasteries