[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm

raeburn raeburn@source.lon-capa.org
Fri, 26 Dec 2008 16:34:01 -0000


raeburn		Fri Dec 26 16:34:01 2008 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Efficiency improvements in change detection for IP-based server status access.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.81 loncom/interface/domainprefs.pm:1.82
--- loncom/interface/domainprefs.pm:1.81	Thu Dec 25 01:52:49 2008
+++ loncom/interface/domainprefs.pm	Fri Dec 26 16:34:01 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.81 2008/12/25 01:52:49 raeburn Exp $
+# $Id: domainprefs.pm,v 1.82 2008/12/26 16:34:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4998,19 +4998,26 @@
             }
             my @currmachines = split(/,/,$currserverstatus{$type}{'machines'});
             my @newmachines = split(/,/,$newserverstatus{$type}{'machines'});
-            foreach my $item (@currmachines) {
-                if (!grep(/^\Q$item\E$/,@newmachines)) {
-                    $changes{$type}{'machines'} = 1;
-                    last;
-                }
-            }
-            foreach my $item (@newmachines) {
-                if (!grep(/^\Q$item\E$/,@currmachines)) {
+            if (@currmachines > 0) {
+                if (@newmachines > 0) {
+                    foreach my $item (@currmachines) {
+                        if (!grep(/^\Q$item\E$/,@newmachines)) {
+                            $changes{$type}{'machines'} = 1;
+                            last;
+                        }
+                    }
+                    foreach my $item (@newmachines) {
+                        if (!grep(/^\Q$item\E$/,@currmachines)) {
+                            $changes{$type}{'machines'} = 1;
+                            last;
+                        }
+                    }
+                } else {
                     $changes{$type}{'machines'} = 1;
-                    last;
                 }
+            } elsif (@newmachines > 0) {
+                $changes{$type}{'machines'} = 1;
             }
-
         }
     }
     if (keys(%changes) > 0) {