Add a RandomSelector

This commit is contained in:
Honza Kral
2013-05-22 20:30:38 +02:00
parent a093f0258e
commit 9e6714e2fa
+8
View File
@@ -12,6 +12,14 @@ class ConnectionSelector(object):
self.connection_opts = opts
class RandomSelector(ConnectionSelector):
"""
Select a connection at random
"""
def select(self, connections):
return random.choice(connections)
class RoundRobinSelector(ConnectionSelector):
" Default selector using round-robin. "
def __init__(self, opts):