bernd-wechner / CoGs

Competitive Gamers Leaderboard Server (CoGs LS)
2 stars 4 forks source link

Move the rating rebuild code to the background with progress bars #7

Open bernd-wechner opened 5 years ago

bernd-wechner commented 5 years ago

Excellent walk through here:

https://buildwithdjango.com/blog/post/celery-progress-bars/

and a fine sample here to:

https://github.com/sunshineatnoon/Django-Celery-Example

They both use Celery to run background tasks and RabbitMQ to communicate with DJango.

Once we have this in place we need to fix the session edit form processor to estimate the impact of a submitted edit, and seek confirmation before proceeding then if confirmed do the rating rebuild needed (essentially when changing a game session this can impact all downstream sessions and the rating results to the current time). Simlarly changing any TrueSkill settings will demand a complete ratings rebuild for affected games, likewise needs a confirmation page.

This could be very useful for confirmation pages:

https://django-formtools.readthedocs.io/en/latest/preview.html

bernd-wechner commented 4 years ago

Have a proof of concept on Django/Celery underway in the Django Tutorial Project context.

Applications for backgorund jobs include:

1) The ratings rebuilder (original target of this issue) 2) The database integrity checker - which should not bail on first error found, but build a list of isues and present in a results table with links to approriate edit forms to fix them. 3) The leaderboards view which should make an intelligent prediction on likely cost of a request (total number fo snapshots requested) and if over a threshold present a progess bar while fetching them.