mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 06:24:23 +01:00
Improve caching (#1014)
* Cache get place code for users and teams.
* Fix score changing test helpers to clear standings cache when generating a score changing row
* `utils._get_config` will now return `KeyError` instead of None.
* Separate `/api/v1/[users,teams]/[me,id]/[solves,fails,awards]` into seperate API endpoints
* Install `Flask-DebugToolbar` in development
Main goals covered in #1012
This commit is contained in:
@@ -20,7 +20,7 @@ from CTFd.models import (
|
||||
Unlocks,
|
||||
Users,
|
||||
)
|
||||
from CTFd.cache import cache
|
||||
from CTFd.cache import cache, clear_standings
|
||||
from sqlalchemy_utils import drop_database
|
||||
from collections import namedtuple
|
||||
from mock import Mock, patch
|
||||
@@ -268,6 +268,7 @@ def gen_award(db, user_id, team_id=None, name="award_name", value=100):
|
||||
award.date = datetime.datetime.utcnow()
|
||||
db.session.add(award)
|
||||
db.session.commit()
|
||||
clear_standings()
|
||||
return award
|
||||
|
||||
|
||||
@@ -364,6 +365,7 @@ def gen_solve(
|
||||
solve.date = datetime.datetime.utcnow()
|
||||
db.session.add(solve)
|
||||
db.session.commit()
|
||||
clear_standings()
|
||||
return solve
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user