Skip to content

Commit

Permalink
Lower batch size for reanalyzing replays. (#488)
Browse files Browse the repository at this point in the history
* Lower batch size for reanalyzing replays.

5000 took around 90s, so this should take around 9s.

I also added an env variable to customize this behavior, so if we need
to change it later we don't need to touch the source code.

* run black
  • Loading branch information
n-rook authored Dec 3, 2023
1 parent 9cff93c commit 44767f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion project/thscoreboard/replays/views/reanalyze_all_replays.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Reanalyze all replays."""

import os

from django.contrib.auth import decorators as auth_decorators
from django.views.decorators import http as http_decorators
from django.shortcuts import render
Expand All @@ -13,7 +15,7 @@
# The number of replays to view and reanalyze at once.
# This must be low enough that the request will never take over 30 seconds,
# to avoid timeouts.
_BATCH_SIZE = 5000
_BATCH_SIZE = os.environ.get("REANALYZE_BATCH_SIZE") or 1000


def _ShortNameForReplay(r):
Expand Down

0 comments on commit 44767f8

Please sign in to comment.