changed the way args are passed to a storage, should make it easier to use existing...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated / Balancer / Random.pm
index 66f0827..6c66ea8 100644 (file)
@@ -40,12 +40,11 @@ be requested several times in a row.
 =cut
 
 sub next_storage {
-       my $self = shift @_;
-       return (shuffle($self->pool->active_replicants))[0]
-         if $self->pool->active_replicants;
+    my $self = shift @_;
+    my $next = (shuffle($self->pool->active_replicants))[0];
+    return $next ? $next : $self->master;
 }
 
-
 =head1 AUTHOR
 
 John Napiorkowski <john.napiorkowski@takkle.com>