[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Fri Oct 3 22:44:20 EDT 2014
raeburn Sat Oct 4 02:44:20 2014 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface domainprefs.pm
Log:
- For 2.11
- Backport 1.252.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.53 loncom/interface/domainprefs.pm:1.160.6.54
--- loncom/interface/domainprefs.pm:1.160.6.53 Wed Aug 6 17:21:34 2014
+++ loncom/interface/domainprefs.pm Sat Oct 4 02:44:18 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.53 2014/08/06 17:21:34 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.54 2014/10/04 02:44:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -10774,16 +10774,17 @@
\%defaultshash,$dom);
if ($putresult eq 'ok') {
if (keys(%changes) > 0) {
+ my %toupdate;
if (ref($changes{'delete'}) eq 'ARRAY') {
foreach my $balancer (sort(@{$changes{'delete'}})) {
$resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>';
- my $cachekey = &escape('loadbalancing').':'.&escape($dom);
- &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
+ $toupdate{$balancer} = 1;
}
}
if (ref($changes{'add'}) eq 'ARRAY') {
foreach my $balancer (sort(@{$changes{'add'}})) {
$resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer);
+ $toupdate{$balancer} = 1;
}
}
if (ref($changes{'curr'}) eq 'HASH') {
@@ -10826,6 +10827,13 @@
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') ||
($rule eq 'balancer') || ($rule eq 'offloadedto')) {
$balancetext = $ruletitles{$rule};
+ if (($rule eq 'balancer') || ($rule eq 'offloadedto')) {
+ foreach my $sparetype (@sparestypes) {
+ if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') {
+ map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}});
+ }
+ }
+ }
} else {
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type});
}
@@ -10834,8 +10842,25 @@
}
}
}
- my $cachekey = &escape('loadbalancing').':'.&escape($dom);
- &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
+ if (keys(%toupdate)) {
+ my %thismachine;
+ my $updatedhere;
+ my $cachetime = 60*60*24;
+ map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
+ foreach my $lonhost (keys(%toupdate)) {
+ if ($thismachine{$lonhost}) {
+ unless ($updatedhere) {
+ &Apache::lonnet::do_cache_new('loadbalancing',$dom,
+ $defaultshash{'loadbalancing'},
+ $cachetime);
+ $updatedhere = 1;
+ }
+ } else {
+ my $cachekey = &escape('loadbalancing').':'.&escape($dom);
+ &Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]);
+ }
+ }
+ }
}
}
if ($resulttext ne '') {
More information about the LON-CAPA-cvs
mailing list