[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 21 Jan 2006 08:03:27 -0000


albertel		Sat Jan 21 03:03:27 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - perf improvement for the super grader state
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.95 loncom/homework/bridgetask.pm:1.96
--- loncom/homework/bridgetask.pm:1.95	Fri Jan 20 20:46:14 2006
+++ loncom/homework/bridgetask.pm	Sat Jan 21 03:03:27 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.95 2006/01/21 01:46:14 albertel Exp $
+# $Id: bridgetask.pm,v 1.96 2006/01/21 08:03:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1180,6 +1180,7 @@
 	return (0,0,0);
     }
     my ($entries,$ready_to_grade,$locks)=(0,0,0);
+    my %slot_cache;
     foreach my $key (sort(keys(%queue))) {
 	if ($key=~/locked$/) {
 	    $locks++;
@@ -1189,8 +1190,11 @@
 	    my ($symb,$uname,$udom) = &decode_queue_key($key);
 	    $entries++;
 	    my $slot=$queue{$key}->[0];
-	    my %slot_data=&Apache::lonnet::get_slot($slot);
-	    if (time > $slot_data{'endtime'}) {
+	    if (!exists($slot_cache{$slot})) {
+		my %slot_data=&Apache::lonnet::get_slot($slot);
+		$slot_cache{$slot} = \%slot_data;
+	    }
+	    if (time > $slot_cache{$slot}{'endtime'}) {
 		$ready_to_grade++;
 	    }
 	}