Skip to content

Commit

Permalink
don't reprocess replays except for pro matches
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Dec 1, 2023
1 parent 861aa64 commit 7ed9d36
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions routes/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ The OpenDota API offers 50,000 free calls per month and a rate limit of 60 reque
// match id request, get data from API
return utility.getData(
utility.generateJob("api_details", match).url,
(err, body) => {
async (err, body) => {
if (err) {
// couldn't get data from api, non-retryable
return exitWithJob(JSON.stringify(err));
Expand All @@ -1696,13 +1696,16 @@ The OpenDota API offers 50,000 free calls per month and a rate limit of 60 reque
}
// match details response
const match = body.result;
// Check if match is already parsed
const isAlreadyParsed = Boolean((await db.raw('select match_id from parsed_matches where match_id = ?', [match.match_id])).rows[0]);
return queries.insertMatch(
match,
{
type: "api",
attempts: 1,
priority: req.query.api_key ? 2 : 1,
forceParse: true,
// Reduce load: only actually reprocess the replay for league matches
forceParse: Boolean(match.leagueid) || !isAlreadyParsed,
},
exitWithJob
);
Expand Down

0 comments on commit 7ed9d36

Please sign in to comment.