diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-28 21:22:48 -0600 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-28 21:22:48 -0600 |
commit | 14622b310f170daa7d720da85c65a68dc6784702 (patch) | |
tree | 32c7d59624a9e5eeff3c9edcce7e4c84944f9ff8 /src | |
parent | 39b7da9bbaa4d0dd77b2592e8ed71f631cd0ac0e (diff) | |
download | skyblock-api-14622b310f170daa7d720da85c65a68dc6784702.tar.gz skyblock-api-14622b310f170daa7d720da85c65a68dc6784702.tar.bz2 skyblock-api-14622b310f170daa7d720da85c65a68dc6784702.zip |
fix constant cache
Diffstat (limited to 'src')
-rw-r--r-- | src/constants.ts | 3 | ||||
-rw-r--r-- | src/database.ts | 2 | ||||
-rw-r--r-- | src/index.ts | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/constants.ts b/src/constants.ts index c78b7ea..1792b94 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -66,11 +66,12 @@ async function fetchFile(path: string): Promise<GithubFile> { }, ) const data = await r.json() - return { + const file = { path: data.path, content: Buffer.from(data.content, data.encoding).toString(), sha: data.sha } + fileCache.set(path, file) } /** diff --git a/src/database.ts b/src/database.ts index e1fec7e..d3e2291 100644 --- a/src/database.ts +++ b/src/database.ts @@ -78,7 +78,7 @@ function getMemberLeaderboardAttributes(member: CleanMember) { } -export async function fetchAllLeaderboardsCategoriezed(): Promise<{ [ category: string ]: string[] }> { +export async function fetchAllLeaderboardsCategorized(): Promise<{ [ category: string ]: string[] }> { const memberLeaderboardAttributes = await fetchAllMemberLeaderboardAttributes() const categorizedLeaderboards: { [ category: string ]: string[] } = {} for (const leaderboard of memberLeaderboardAttributes) { diff --git a/src/index.ts b/src/index.ts index f35363a..fa3b75f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { fetchMemberProfile, fetchUser } from './hypixel' import express from 'express' -import { fetchAllLeaderboardsCategoriezed, fetchMemberLeaderboard } from './database' +import { fetchAllLeaderboardsCategorized, fetchMemberLeaderboard } from './database' const app = express() @@ -42,7 +42,7 @@ app.get('/leaderboard/:name', async(req, res) => { app.get('/leaderboards', async(req, res) => { res.json( - await fetchAllLeaderboardsCategoriezed() + await fetchAllLeaderboardsCategorized() ) }) |