From 26bae0b25c599941d1dac3a1f047c6c615a17503 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 29 Nov 2023 17:17:53 +0000 Subject: [PATCH] do unparsed benchmarks and simplify insert stack --- store/queries.js | 27 +++++---------------------- svc/benchmarks.js | 4 ++-- svc/parser.js | 7 ------- util/benchmarksUtil.js | 12 ++++++------ 4 files changed, 13 insertions(+), 37 deletions(-) diff --git a/store/queries.js b/store/queries.js index d311491db..a7d7913b6 100644 --- a/store/queries.js +++ b/store/queries.js @@ -1070,23 +1070,6 @@ function insertMatch(match, options, cb) { cb(); } - function tellFeed(cb) { - if (options.origin === "scanner" || options.doTellFeed) { - redis.xadd( - "feed", - "maxlen", - "~", - "100", - "*", - "data", - JSON.stringify({ ...match, origin: options.origin }), - cb - ); - } else { - cb(); - } - } - function decideLogParse(cb) { if (match.leagueid) { db.select("leagueid") @@ -1464,14 +1447,15 @@ function insertMatch(match, options, cb) { } function decideScenarios(cb) { - if (options.doScenarios) { + if (options.type === 'parsed' && + match.match_id % 100 < config.SCENARIOS_SAMPLE_PERCENT) { return redis.rpush("scenariosQueue", match.match_id, cb); } return cb(); } - function decideParsedBenchmarks(cb) { - if (options.doParsedBenchmarks) { + function decideBenchmarks(cb) { + if (options.origin === "scanner" && match.match_id % 100 < config.BENCHMARKS_SAMPLE_PERCENT) { return redis.rpush("parsedBenchmarksQueue", match.match_id, cb); } return cb(); @@ -1606,7 +1590,6 @@ function insertMatch(match, options, cb) { async.series( { preprocess, - tellFeed, decideLogParse, updateMatchGcData, upsertMatch, @@ -1619,7 +1602,7 @@ function insertMatch(match, options, cb) { telemetry, decideCounts, decideScenarios, - decideParsedBenchmarks, + decideBenchmarks, decideMmr, decideProfile, decideGcData, diff --git a/svc/benchmarks.js b/svc/benchmarks.js index 496d25053..d5e95d467 100644 --- a/svc/benchmarks.js +++ b/svc/benchmarks.js @@ -7,7 +7,7 @@ const redis = require("../store/redis"); const { benchmarks } = benchmarksUtil; -async function doParsedBenchmarks(matchID, cb) { +async function doBenchmarks(matchID, cb) { try { const match = await buildMatch(matchID); if (match.players && utility.isSignificant(match)) { @@ -50,4 +50,4 @@ async function doParsedBenchmarks(matchID, cb) { } } -queue.runQueue("parsedBenchmarksQueue", 1, doParsedBenchmarks); +queue.runQueue("parsedBenchmarksQueue", 1, doBenchmarks); diff --git a/svc/parser.js b/svc/parser.js index f43c8eeb6..03ac0e644 100755 --- a/svc/parser.js +++ b/svc/parser.js @@ -50,13 +50,6 @@ function runParse(match, job, cb) { type: "parsed", skipParse: true, doLogParse: match.doLogParse, - doScenarios: - match.origin === "scanner" && - match.match_id % 100 < config.SCENARIOS_SAMPLE_PERCENT, - doParsedBenchmarks: - match.origin === "scanner" && - match.match_id % 100 < config.BENCHMARKS_SAMPLE_PERCENT, - doTellFeed: match.origin === "scanner", }, cb ); diff --git a/util/benchmarksUtil.js b/util/benchmarksUtil.js index f99745b5e..968cce3f1 100644 --- a/util/benchmarksUtil.js +++ b/util/benchmarksUtil.js @@ -20,12 +20,12 @@ const benchmarks = { tower_damage(m, p) { return p.tower_damage; }, - stuns_per_min(m, p) { - return (p.stuns / m.duration) * 60; - }, - lhten(m, p) { - return p.lh_t && p.lh_t[10]; - }, + // stuns_per_min(m, p) { + // return (p.stuns / m.duration) * 60; + // }, + // lhten(m, p) { + // return p.lh_t && p.lh_t[10]; + // }, }; module.exports = {