X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FReplicated.pm;h=8ae3cf4e67051ca9c2962f87fcda8de81dbc34fc;hb=2ed909315eef3db2b248df574abd644a1ecfd0f3;hp=a9be9abf88e56cdf4b215e7f9f2e0c2cbd9ce6e2;hpb=26ab719a4d6ee414537c815677b9884b64417539;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index a9be9ab..8ae3cf4 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -32,15 +32,8 @@ tasks ## supports everything that method supports, such as connecting to an ## existing database handle. [$dbh], - \%global_opts ); - - ## a hash of replicants, keyed by their DSN - my %replicants = $schema->storage->replicants; - my $replicant = $schema->storage->get_replicant($dsn); - $replicant->status; - $replicant->is_active; - $replicant->active; + =head1 DESCRIPTION @@ -105,6 +98,7 @@ has 'master' => ( txn_rollback sth deploy + schema /], ); @@ -277,6 +271,19 @@ sub _build_balancer { } +=head2 around: create_replicants + +All calls to create_replicants needs to have an existing $schema tacked onto +top of the args + +=cut + +around 'create_replicants' => sub { + my ($method, $self, @args) = @_; + $self->$method($self->schema, @args); +}; + + =head2 after: get_current_replicant_storage Advice on the current_replicant_storage attribute. Each time we use a replicant @@ -285,10 +292,11 @@ the load evenly (hopefully) across existing capacity. =cut -after 'get_current_replicant' => sub { +after 'current_replicant' => sub { my $self = shift @_; my $next_replicant = $self->next_storage($self->pool); - + +warn '......................'; $self->set_current_replicant($next_replicant); };