Skip to content

Commit

Permalink
Removed fetching contest cache + fixed cache rtiming on contest score…
Browse files Browse the repository at this point in the history
…board
JasonLovesDoggo committed Mar 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3038a60 commit 66cfc3a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gameserver/views/contest.py
Original file line number Diff line number Diff line change
@@ -183,15 +183,15 @@ def get_queryset(self):
queryset = cache.get(cache_key)
if not queryset or self.request.GET.get('cache_reset', '').casefold() == "yaaaa":
queryset = self.object.ranks().prefetch_related('team', 'submissions__problem')
cache.set(cache_key, queryset, 5 * 5) # Cache for 5 minutes (300 seconds)
cache.set(cache_key, queryset, 60 * 5) # Cache for 5 minutes (300 seconds)
return queryset

def _get_contest(self, slug):
cache_key = f"contest_{slug}_scoreboard_contest"
contest = cache.get(cache_key)
if not contest or self.request.GET.get('cache_reset', '').casefold() == "yaaaa":
contest = get_object_or_404(models.Contest, slug=slug)
cache.set(cache_key, contest, 5 * 5) # Cache for 5 minutes (300 seconds)
# cache_key = f"contest_{slug}_scoreboard_contest"
# contest = cache.get(cache_key)
# if not contest or self.request.GET.get('cache_reset', '').casefold() == "yaaaa":
contest = get_object_or_404(models.Contest, slug=slug)
# cache.set(cache_key, contest, 60 * 5) # Cache for 5 minutes (300 seconds)
return contest

def get(self, request, *args, **kwargs):

0 comments on commit 66cfc3a

Please sign in to comment.