diff --git a/relay/database.py b/relay/database.py index 70b4e25..eee269e 100644 --- a/relay/database.py +++ b/relay/database.py @@ -125,7 +125,7 @@ class Connection(tinysql.ConnectionMixin): row = self.get_instance(domain) if not row: - raise KeyError(name) + raise KeyError(domain) self.delete('instances', id=row.id) @@ -192,6 +192,7 @@ class Connection(tinysql.ConnectionMixin): def get_instances(self): query = 'SELECT * FROM instances WHERE joined IS NOT NULL' + query += ' ORDER BY domain ASC' return self.execute(query, table='instances').all() @@ -204,7 +205,7 @@ class Connection(tinysql.ConnectionMixin): def get_requests(self): - query = 'SELECT * FROM instances WHERE joined IS NULL' + query = 'SELECT * FROM instances WHERE joined IS NULL ORDER BY domain ASC' return self.execute(query, table='instances').all()