Add a RandomSelector
This commit is contained in:
@@ -12,6 +12,14 @@ class ConnectionSelector(object):
|
|||||||
self.connection_opts = opts
|
self.connection_opts = opts
|
||||||
|
|
||||||
|
|
||||||
|
class RandomSelector(ConnectionSelector):
|
||||||
|
"""
|
||||||
|
Select a connection at random
|
||||||
|
"""
|
||||||
|
def select(self, connections):
|
||||||
|
return random.choice(connections)
|
||||||
|
|
||||||
|
|
||||||
class RoundRobinSelector(ConnectionSelector):
|
class RoundRobinSelector(ConnectionSelector):
|
||||||
" Default selector using round-robin. "
|
" Default selector using round-robin. "
|
||||||
def __init__(self, opts):
|
def __init__(self, opts):
|
||||||
|
|||||||
Reference in New Issue
Block a user