From feca907499070bc13cac0088dee26caeade504b0 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 1 Aug 2011 10:44:52 -0700 Subject: [PATCH] apply zooko's advice: storage_client get_known_servers() returns a frozenset, caller sorts refs #1363 --- src/allmydata/storage_client.py | 9 +++------ src/allmydata/web/root.py | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py index 187828d1..aa696edb 100644 --- a/src/allmydata/storage_client.py +++ b/src/allmydata/storage_client.py @@ -124,16 +124,13 @@ class StorageFarmBroker: return sorted(self.get_connected_servers(), key=_permuted) def get_all_serverids(self): - serverids = set() - serverids.update(self.servers.keys()) - return frozenset(serverids) + return frozenset(self.servers.keys()) def get_connected_servers(self): - return frozenset([s for s in self.get_known_servers() - if s.get_rref()]) + return frozenset([s for s in self.servers.values() if s.get_rref()]) def get_known_servers(self): - return sorted(self.servers.values(), key=lambda s: s.get_serverid()) + return frozenset(self.servers.values()) def get_nickname_for_serverid(self, serverid): if serverid in self.servers: diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 1bef5832..d7a832f5 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -256,7 +256,7 @@ class Root(rend.Page): def data_services(self, ctx, data): sb = self.client.get_storage_broker() - return sb.get_known_servers() + return sorted(sb.get_known_servers(), key=lambda s: s.get_serverid()) def render_service_row(self, ctx, server): nodeid = server.get_serverid() -- 2.45.2