From e3944552c5dd8ab861a00f9a071deefdc7f59e13 Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 15 Jan 2015 22:49:52 +0100 Subject: [PATCH] Changed how the server updates the changed typeclasses. Rather than initializing the objects, this fix handles it by writing the new fields to the database directly (which is much faster to boot). This resolves #636, but there are still some cases where it might be dangerous to not replace a faulty typeclass with a default one, so might still need to add that. --- evennia/server/server.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/evennia/server/server.py b/evennia/server/server.py index 6309c558de..b6b174e638 100644 --- a/evennia/server/server.py +++ b/evennia/server/server.py @@ -180,17 +180,17 @@ class Evennia(object): # update the database print " %s:\n '%s' changed to '%s'. Updating unchanged entries in database ..." % (settings_names[i], prev, curr) if i == 0: - [obj.__setattr__("cmdset_storage", curr) for obj in ObjectDB.objects.filter(db_cmdset_storage__exact=prev)] + ObjectDB.objects.filter(db_cmdset_storage__exact=prev).update(db_cmdset_storage=curr) if i == 1: - [ply.__setattr__("cmdset_storage", curr) for ply in PlayerDB.objects.filter(db_cmdset_storage__exact=prev)] + PlayerDB.objects.filter(db_cmdset_storage__exact=prev).update(db_cmdset_storage=curr) if i == 2: - [ply.__setattr__("typeclass_path", curr) for ply in PlayerDB.objects.filter(db_typeclass_path__exact=prev)] + PlayerDB.objects.filter(db_typeclass_path__exact=prev).update(db_typeclass_path=curr) if i in (3, 4, 5, 6): - [obj.__setattr__("typeclass_path", curr) for obj in ObjectDB.objects.filter(db_typeclass_path__exact=prev)] + ObjectDB.objects.filter(db_typeclass_path__exact=prev).update(db_typeclass_path=curr) if i == 7: - [scr.__setattr__("typeclass_path", curr) for scr in ScriptDB.objects.filter(db_typeclass_path__exact=prev)] + ScriptDB.objects.filter(db_typeclass_path__exact=prev).update(db_typeclass_path=curr) if i == 8: - [scr.__setattr__("typeclass_path", curr) for scr in ChannelDB.objects.filter(db_typeclass_path__exact=prev)] + ChannelDB.objects.filter(db_typeclass_path__exact=prev).update(db_typeclass_path=curr) # store the new default and clean caches ServerConfig.objects.conf(settings_names[i], curr) ObjectDB.flush_instance_cache()