S
S
s1vemod2021-06-07 10:49:08
Django
s1vemod, 2021-06-07 10:49:08

How to implement a leaderboard?

Hello, I'm making a Vue + Django leaderboard .

I plan to implement via websocket. But before giving data to the frontend, you need to understand if there are changes.

What a good idea, in Celery to run a task that will sort the data from the database by field, then write it to Redis.
After a while, get it again, sort it, and if the data is different, then overwrite the data in Redis.

Are there ways to implement this easier and more convenient?

Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xa9igor, 2021-06-08
@s1vemod

If you are going to connect celery and redis just for the sake of sorting by field, then why not use it corny: you will get the result on the fly. If this solution takes a long time, then you can cache it in Redis.
SomeModel.objects.all().order_by('sort_field')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question