- Made slave handling more fault tollerant, and slightly higher performing.
This commit is contained in:
parent
3a8bd77cde
commit
0ceb0f68e3
2 changed files with 6 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
processing twice as fast.
|
||||
- Made Weather Data asset more fault tollerant.
|
||||
- Made CS related upgrades more fault tollerant.
|
||||
- Made slave handling more fault tollerant, and slightly higher performing.
|
||||
- Enhanced HTTP caching directives.
|
||||
- fix: Fixing bad link on the Event page to the search engine. Added a new
|
||||
Event template variable called urlSearch to handle it. (perlDreamer Consulting, LLC)
|
||||
|
|
|
|||
|
|
@ -183,17 +183,20 @@ Returns a random slave database handler, if one is defined, otherwise it returns
|
|||
sub dbSlave {
|
||||
my $self = shift;
|
||||
unless (exists $self->{_slave}) {
|
||||
my @slaves = ();
|
||||
foreach (1..3) {
|
||||
my $slave = $self->config->get("dbslave".$_);
|
||||
if (exists $slave->{dsn}) {
|
||||
push(@{$self->{_slave}},WebGUI::SQL->connect($self, $slave->{dsn},$slave->{user},$slave->{pass}));
|
||||
push (@slaves, $slave);
|
||||
}
|
||||
}
|
||||
my $slave = $slaves[rand @slaves];
|
||||
$self->{_slave} = WebGUI::SQL->connect($self, $slave->{dsn},$slave->{user},$slave->{pass});
|
||||
}
|
||||
if ($self->var("adminOn") || !exists $self->{_slave}) {
|
||||
return $self->db;
|
||||
} else {
|
||||
return $self->{_slave}->[rand @{$self->{_slave}}];
|
||||
return $self->{_slave};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue