aboutsummaryrefslogtreecommitdiff
path: root/build/hypixelCached.js
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-03-01 22:00:53 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-03-01 22:00:53 -0600
commit2c2a465efb2535f2d9ce8d5865c276e2e91c4979 (patch)
treeb2d9dafa3337be7aabb0929fc3cd5d96b8b5aee7 /build/hypixelCached.js
parent49f0f038434d1b95f4218b97c7a41be8f869a4f7 (diff)
downloadskyblock-api-2c2a465efb2535f2d9ce8d5865c276e2e91c4979.tar.gz
skyblock-api-2c2a465efb2535f2d9ce8d5865c276e2e91c4979.tar.bz2
skyblock-api-2c2a465efb2535f2d9ce8d5865c276e2e91c4979.zip
change concurrent updating leaderboard members to 1
Diffstat (limited to 'build/hypixelCached.js')
-rw-r--r--build/hypixelCached.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/build/hypixelCached.js b/build/hypixelCached.js
index d41da97..3ef40ec 100644
--- a/build/hypixelCached.js
+++ b/build/hypixelCached.js
@@ -68,7 +68,7 @@ const profileNameCache = new node_cache_1.default({
checkperiod: 60,
useClones: false,
});
-function waitForSet(cache, key, value) {
+function waitForCacheSet(cache, key, value) {
return new Promise((resolve, reject) => {
const listener = (setKey, setValue) => {
if (setKey === key || (value && setValue === value)) {
@@ -90,7 +90,7 @@ async function uuidFromUser(user) {
if (usernameCache.has(util_1.undashUuid(user))) {
// check if the uuid is a key
const username = usernameCache.get(util_1.undashUuid(user));
- // if it has .then, then that means its a waitForSet promise. This is done to prevent requests made while it is already requesting
+ // if it has .then, then that means its a waitForCacheSet promise. This is done to prevent requests made while it is already requesting
if (username.then) {
const { key: uuid, value: _username } = await username;
usernameCache.set(uuid, _username);
@@ -107,8 +107,8 @@ async function uuidFromUser(user) {
}
if (_1.debug)
console.log('Cache miss: uuidFromUser', user);
- // set it as waitForSet (a promise) in case uuidFromUser gets called while its fetching mojang
- usernameCache.set(util_1.undashUuid(user), waitForSet(usernameCache, user, user));
+ // set it as waitForCacheSet (a promise) in case uuidFromUser gets called while its fetching mojang
+ usernameCache.set(util_1.undashUuid(user), waitForCacheSet(usernameCache, user, user));
// not cached, actually fetch mojang api now
let { uuid, username } = await mojang.mojangDataFromUser(user);
if (!uuid) {