agoragames / leaderboard-python

Leaderboards backed by Redis in Python
https://github.com/agoragames/leaderboard-python
MIT License
156 stars 44 forks source link

How to configure it for around 1,00,000 users #60

Open Abhi-khandelwal opened 6 years ago

Abhi-khandelwal commented 6 years ago

I have to show realtime leaderboard for 1,00,000 users , so How can I implement it in my Django webapp ,

If I am insert my data through Loop it will take too much time and load , so Can you please tell me what will the best approach for this Here you can Check my code Models.py

`class Score(models.Model): name=models.CharField(max_length=211) score=models.IntegerField()

def str(self): return self.name `

Views.py

def Index(request): a=Score.objects.all() highscore_lb=CompetitionRankingLeaderboard('sdfs') for index in a: highscore_lb.rank_member(index.name, index.score) b=highscore_lb.all_leaders() return render(request,'index.html',{'b':b})

czarneckid commented 6 years ago

You can use the rank_members method to rank multiple members at once. For example, https://github.com/agoragames/leaderboard-python/blob/master/test/leaderboard/leaderboard_test.py#L494-L497