Skip to content

Commit

Permalink
remove unnecessary parse job data
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Dec 1, 2023
1 parent 435bd99 commit be2dce9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
6 changes: 4 additions & 2 deletions store/buildMatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ async function getMatch(matchId) {
// If we fetched from archive we already have players
playersMatchData = match.players || (await getPlayerMatchData(matchId));
if (playersMatchData.length === 0) {
throw new Error('no players found for match');
// Could be due to partial deletion where we only finished deleting players
await backfill(matchId);
playersMatchData = await getPlayerMatchData(matchId);
}
} catch (e) {
// TODO we can probably remove this try/catch after bad data is fixed
console.error(e);
if (
e.message.startsWith('no players found') ||
e.message.startsWith('Unexpected') ||
e.message.includes('Attempt to access memory outside buffer bounds')
) {
Expand Down
9 changes: 2 additions & 7 deletions store/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,6 @@ function insertMatch(match, options, cb) {

JSON.stringify({
match_id: match.match_id,
duration: match.duration,
start_time: match.start_time,
})
);
Expand Down Expand Up @@ -1528,15 +1527,11 @@ function insertMatch(match, options, cb) {
{
data: {
match_id: match.match_id,
// leagueid to determine whether to upsert Postgres after parse
leagueid: match.leagueid,
game_mode: match.game_mode,
radiant_win: match.radiant_win,
// start_time just for debug logging
start_time: match.start_time,
duration: match.duration,
replay_blob_key: match.replay_blob_key,
pgroup: match.pgroup,
ability_upgrades: abilityUpgrades,
allowBackup: options.allowBackup,
origin: options.origin,
},
},
Expand Down
4 changes: 0 additions & 4 deletions svc/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ function runParse(match, job, cb) {

function parseProcessor(job, cb) {
const match = job;
if (!match.game_mode && match.origin !== 'scanner') {
// Skip parses without game_mode that weren't from scanner (do this to clear queue of event matches)
return cb();
}
async.series(
{
getDataSource(cb) {
Expand Down

0 comments on commit be2dce9

Please sign in to comment.