diff options
author | mat <github@matdoes.dev> | 2021-10-03 12:08:41 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-10-03 12:08:41 -0500 |
commit | 7afe165979419f1fd96f6356f32ded35cb143de9 (patch) | |
tree | 9fd58fb5721804c1f470e7ae0ac13e7eb37b3d27 /build | |
parent | 1291f0f32b6f626666b6fb86b8d87e3c4293cb7c (diff) | |
download | skyblock-api-7afe165979419f1fd96f6356f32ded35cb143de9.tar.gz skyblock-api-7afe165979419f1fd96f6356f32ded35cb143de9.tar.bz2 skyblock-api-7afe165979419f1fd96f6356f32ded35cb143de9.zip |
attempt to fix memory leak
Diffstat (limited to 'build')
-rw-r--r-- | build/hypixelCached.js | 8 | ||||
-rw-r--r-- | build/index.js | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/build/hypixelCached.js b/build/hypixelCached.js index 56671ab..8018dc4 100644 --- a/build/hypixelCached.js +++ b/build/hypixelCached.js @@ -7,7 +7,7 @@ import * as mojang from './mojang.js'; import NodeCache from 'node-cache'; import { debug } from './index.js'; import LRUCache from 'lru-cache'; -import { TLSSocket } from 'tls'; +// import { TLSSocket } from 'tls' // cache usernames for 30 minutes /** uuid: username */ export const usernameCache = new NodeCache({ @@ -16,9 +16,9 @@ export const usernameCache = new NodeCache({ checkperiod: 60, useClones: false, }); -usernameCache.setMaxListeners(50); -// @ts-ignore for some reason the typings don't have setMaxListeners but it does -TLSSocket.setMaxListeners(50); +// usernameCache.setMaxListeners(50) +// // @ts-ignore for some reason the typings don't have setMaxListeners but it does +// TLSSocket.setMaxListeners(50) export const basicProfilesCache = new NodeCache({ stdTTL: 60 * 10, checkperiod: 60, diff --git a/build/index.js b/build/index.js index 8521a1c..050e22a 100644 --- a/build/index.js +++ b/build/index.js @@ -4,6 +4,7 @@ import rateLimit from 'express-rate-limit'; import * as constants from './constants.js'; import * as discord from './discord.js'; import express from 'express'; +import { basicPlayerCache, basicProfilesCache, playerCache, profileCache, profileNameCache, profilesCache, usernameCache } from './hypixelCached.js'; const app = express(); export const debug = false; const mainSiteUrl = 'https://skyblock.matdoes.dev'; @@ -33,6 +34,13 @@ app.get('/', async (req, res) => { finishedCachingRawLeaderboards, leaderboardUpdateMemberQueueSize: leaderboardUpdateMemberQueue.size, leaderboardUpdateProfileQueueSize: leaderboardUpdateProfileQueue.size, + usernameCacheSize: usernameCache.keys().length, + basicProfilesCacheSize: basicProfilesCache.keys().length, + playerCacheSize: playerCache.keys().length, + basicPlayerCacheSize: basicPlayerCache.keys().length, + profileCacheSize: profileCache.keys().length, + profilesCacheSize: profilesCache.keys().length, + profileNameCacheSize: profileNameCache.keys().length, // key: getKeyUsage() }); }); |