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

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 29 Oct 2002 19:53:45 -0000


matthew		Tue Oct 29 14:53:45 2002 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  Towards Bug 916.  Searching is a little smarter - no longer will we see
  'waiting on BLANK'.   Also, the timer will count down only after all the
  servers have been contacted.
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.158 loncom/interface/lonsearchcat.pm:1.159
--- loncom/interface/lonsearchcat.pm:1.158	Mon Sep 16 16:57:28 2002
+++ loncom/interface/lonsearchcat.pm	Tue Oct 29 14:53:45 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.158 2002/09/16 20:57:28 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.159 2002/10/29 19:53:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1976,7 +1976,7 @@
     my $time_remaining = $max_time - (time - $starttime) ;
     my $last_time = $time_remaining;
     &update_seconds($r,$time_remaining);
-    while (($time_remaining > 0) && 
+    while (($time_remaining > 0) &&
            ((@Servers_to_contact) || keys(%Server_status))) {
         # Send out a search request if it needs to be done.
         if (@Servers_to_contact) {
@@ -1994,7 +1994,13 @@
             # left to contact.  
             sleep(1); 
         }
-        &update_status($r,'waiting on '.(join(' ',keys(%Server_status))));
+        #
+        if (scalar (keys(%Server_status))) {
+            &update_status($r,'waiting on '.(join(' ',keys(%Server_status))));
+        }
+        #
+        # Loop through the servers we have contacted but do not
+        # have results from yet, looking for results.
         while (my ($server,$status) = each(%Server_status)) {
             last if ($connection->aborted());
             if ($status eq 'con_lost') {
@@ -2057,6 +2063,7 @@
         }
         last if ($connection->aborted());
         # Finished looping through the servers
+        $starttime = time if (@Servers_to_contact);
         $time_remaining = $max_time - (time - $starttime) ;
         if ($last_time - $time_remaining > 0) {
             $last_time = $time_remaining;