mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-15 14:29:25 +00:00
galaxy: big refactor
Main changes: - Multiple Galaxy objects can now exist at the same time in DB. This allows for ruling a new galaxy while still displaying the old one. - The criteria to quickly know whether a user is a possible citizen is now a simple query on picture count. This avoids a very complicated query to database, that could often result in huge working memory load. With this change, it should be possible to run the galaxy even on a vanilla Postgres that didn't receive fine tuning for the Sith's galaxy.
This commit is contained in:
@ -49,11 +49,10 @@ class Command(BaseCommand):
|
||||
logger.setLevel(logging.NOTSET)
|
||||
|
||||
logger.info("The Galaxy is being ruled by the Sith.")
|
||||
Galaxy.rule()
|
||||
logger.info(
|
||||
"Caching current Galaxy state for a quicker display of the Empire's power."
|
||||
)
|
||||
Galaxy.make_state()
|
||||
galaxy = Galaxy.objects.create()
|
||||
galaxy.rule()
|
||||
logger.info("Sending old galaxies' remains to garbage.")
|
||||
Galaxy.objects.filter(state__isnull=True).delete()
|
||||
|
||||
logger.info("Ruled the galaxy in {} queries.".format(len(connection.queries)))
|
||||
if options["verbosity"] > 2:
|
||||
|
Reference in New Issue
Block a user