=cut
has 'maximum_lag' => (
- is=>'ro',
+ is=>'rw',
isa=>'Num',
required=>1,
lazy=>1,
=cut
sub all_replicants {
- my $self = shift @_;
- return values %{$self->replicants};
+ my $self = shift @_;
+ return values %{$self->replicants};
}
=head2 validate_replicants
=cut
sub validate_replicants {
- my $self = shift @_;
- foreach my $replicant($self->all_replicants) {
-
- }
+ my $self = shift @_;
+ foreach my $replicant($self->all_replicants) {
+ if(
+ $replicant->is_replicating &&
+ $replicant->lag_behind_master <= $self->maximum_lag &&
+ $replicant->ensure_connected
+ ) {
+ ## TODO:: Hook debug for this
+ $replicant->active(1)
+ } else {
+ ## TODO:: Hook debug for this
+ $replicant->active(0);
+ }
+ }
}
=head1 AUTHOR