diff --git a/store/buildStatus.mjs b/store/buildStatus.mjs index 166848575..89328c9d5 100644 --- a/store/buildStatus.mjs +++ b/store/buildStatus.mjs @@ -80,11 +80,15 @@ export default function buildStatus(db, redis, cb) { }, seqNumDelay(cb) { // It's slow to query Steam API so use the value saved by monitor - redis.hget('health', 'seqNumDelay', cb); + redis.hget('health', 'seqNumDelay', (err, data) => { + cb(err, JSON.parse(data).metric) + }); }, parseQueue(cb) { // It's slow to count in postgres so use the value saved by monitor - redis.hget('health', 'parseDelay', cb); + redis.hget('health', 'parseDelay', (err, data) => { + cb(err, JSON.parse(data).metric); + }); }, fhQueue(cb) { redis.llen('fhQueue', cb); diff --git a/svc/profiler.mjs b/svc/profiler.mjs index 517f993f1..b252c2881 100644 --- a/svc/profiler.mjs +++ b/svc/profiler.mjs @@ -3,7 +3,7 @@ import queries from '../store/queries.mjs'; import db from '../store/db.mjs'; import utility from '../util/utility.mjs'; const { insertPlayerPromise, bulkIndexPlayer } = queries; -const { getData, generateJob, convert64to32 } = utility; +const { getDataPromise, generateJob, convert64to32 } = utility; while (true) { // To optimize the api call we need to do 100 players at a time diff --git a/svc/proplayers.mjs b/svc/proplayers.mjs index 2a14f46c9..b8b4dc587 100644 --- a/svc/proplayers.mjs +++ b/svc/proplayers.mjs @@ -5,14 +5,16 @@ import utility from '../util/utility.mjs'; const { generateJob, getDataPromise } = utility; while (true) { + console.time('doProPlayers'); const container = generateJob('api_notable', {}); const body = await getDataPromise(container.url); - await Promise.all( +await Promise.all( body.player_infos.map((p) => queries.upsertPromise(db, 'notable_players', p, { account_id: p.account_id, }) ) ); + console.timeEnd('doProPlayers'); await new Promise((resolve) => setTimeout(resolve, 30 * 60 * 1000)); }