feat: moved tankopedia and tankaverages into a runtime cache

This commit is contained in:
TresAbhi committed 2023-07-05 02:09:36 +00:00
1 parent 95b105cb65
commit 00b721f34f
29 files changed
+268 -235

No files matched your search

+2 -2
View File
@@ -2,7 +2,7 @@ import { go } from 'fuzzysort';
import throwError from '../node/throwError.js';
import { TANKS, tankopedia } from './tankopedia.js';
export default function resolveTankId(tank: string) {
export default async function resolveTankId(tank: string) {
const number = parseInt(tank);
if (Number.isNaN(number)) {
@@ -17,7 +17,7 @@ export default function resolveTankId(tank: string) {
return searchResult[0].obj.tank_id;
}
} else {
if (tankopedia[number]) {
if ((await tankopedia)[number]) {
return number;
} else {
throw throwError(