# HG changeset patch # User Ralph Meijer # Date 1113309265 0 # Node ID c4ee16bc48e5833f3d002e8ae6f6a96424e08db9 # Parent 8f99b4f7aea2938ecbec9b10cc8738877b8e377b Change Node.set_configuration() to set cached configuration in a callback. diff -r 8f99b4f7aea2 -r c4ee16bc48e5 idavoll/pgsql_storage.py --- a/idavoll/pgsql_storage.py Tue Apr 12 12:28:07 2005 +0000 +++ b/idavoll/pgsql_storage.py Tue Apr 12 12:34:25 2005 +0000 @@ -120,24 +120,25 @@ return self._config def set_configuration(self, options): - return self._dbpool.runInteraction(self._set_configuration, - options) - - def _set_configuration(self, cursor, options): - self._check_node_exists(cursor) - config = copy.copy(self._config) for option in options: if option in config: config[option] = options[option] + d = self._dbpool.runInteraction(self._set_configuration, config) + d.addCallback(self._set_cached_configuration, config) + return d + + def _set_configuration(self, cursor, config): + self._check_node_exists(cursor) cursor.execute("""UPDATE nodes SET persistent=%s, deliver_payload=%s WHERE node=%s""", (config["pubsub#persist_items"], config["pubsub#deliver_payloads"], self.id.encode('utf-8'))) + def _set_cached_configuration(self, void, config): self._config = config def get_meta_data(self):