-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #284 from osuTitanic/dev
Fix rank indexing job & minimize requirements file
- Loading branch information
Showing
9 changed files
with
68 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
from app.common.cache import leaderboards | ||
from app.common.database import users | ||
|
||
import app | ||
|
||
def index_ranks(): | ||
""" | ||
This will run on startup as a background job, and check if the redis leaderboards are empty. | ||
It will then try to re-index every active player in the leaderboards. | ||
This should actually never happen, but it can be useful in emergency situations. | ||
""" | ||
if not leaderboards.top_players(0): | ||
with app.session.database.managed_session() as session: | ||
# Redis cache was flushed | ||
active_players = users.fetch_all(session=session) | ||
|
||
app.session.logger.info(f'Indexing player ranks... ({len(active_players)})') | ||
|
||
for player in active_players: | ||
for stats in player.stats: | ||
leaderboards.update( | ||
stats, | ||
player.country.lower() | ||
) | ||
|
||
app.session.logger.info('Index complete!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,15 @@ | ||
aiohttp==3.9.1 | ||
aiosignal==1.3.1 | ||
async-timeout==4.0.3 | ||
attrs==23.2.0 | ||
Automat==22.10.0 | ||
bcrypt==4.1.2 | ||
boto3==1.34.13 | ||
boto3-type-annotations-with-docs==0.3.1 | ||
botocore==1.34.13 | ||
certifi==2023.11.17 | ||
chardet==5.2.0 | ||
charset-normalizer==3.3.2 | ||
click==8.1.7 | ||
colorama==0.4.6 | ||
constantly==23.10.4 | ||
frozenlist==1.4.1 | ||
geoip2==4.8.0 | ||
greenlet==3.0.3 | ||
hyperlink==21.0.0 | ||
idna==3.6 | ||
incremental==22.10.0 | ||
jmespath==1.0.1 | ||
maxminddb==2.5.1 | ||
multidict==6.0.4 | ||
psycopg2==2.9.9 | ||
python-dateutil==2.8.2 | ||
python-dotenv==1.0.0 | ||
python-http-client==3.3.7 | ||
pytimeparse==1.1.8 | ||
pytz==2023.3.post1 | ||
titanic-pp-py==0.0.6 | ||
psycopg2-binary==2.9.9 | ||
sqlalchemy==2.0.25 | ||
python-dotenv==1.0.1 | ||
twisted==23.10.0 | ||
redis==5.0.1 | ||
requests==2.31.0 | ||
s3transfer==0.10.0 | ||
boto3-type-annotations==0.3.1 | ||
boto3==1.34.31 | ||
pytz==2023.4 | ||
pytimeparse==1.1.8 | ||
geoip2==4.8.0 | ||
bcrypt==4.1.2 | ||
sendgrid==6.11.0 | ||
six==1.16.0 | ||
SQLAlchemy==2.0.25 | ||
starkbank-ecdsa==2.2.0 | ||
timeago==1.0.16 | ||
titanic-pp-py==0.0.6 | ||
Twisted==23.10.0 | ||
typing-extensions==4.9.0 | ||
urllib3==1.26.18 | ||
yarl==1.9.4 | ||
zope.interface==6.1 | ||
timeago==1.0.16 |