[svn:p5ee] r6473 - in p5ee/trunk/App-WorkQueue/lib/App: . WorkQueue

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Mon Jun  5 16:18:12 2006
New Revision: 6473

Modified:
   p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm
   p5ee/trunk/App-WorkQueue/lib/App/WorkQueue/Repository.pm

Log:
fixed bug in _refill_buffer() logic which was in _push_in_mem()

Modified: p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm
==============================================================================
--- p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm	(original)
+++ p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm	Mon Jun  5 16:18:12 2006
@@ -292,7 +292,7 @@
                         $removed = 1;
                     }
                 }
-                else {
+                else { # this block, we are certain we are not comparing to ourselves
                     if ($removed && !$inserted && $self->_compare_entries($entry, $ent) > -1) {
                         $self->update($entry,[$self->{status_attrib}],[$self->{STATUS_UNACQUIRED}]);
                         splice(@$entries, $i+1, 0, $entry);
@@ -303,8 +303,14 @@
             }
         }
         else {
+            my ($cmp);
             for (my $i = $#$entries; $i >= 0; $i--) {
-                if ($self->_compare_entries($entry, $entries->[$i]) > -1) {
+                $cmp = $self->_compare_entries($entry, $entries->[$i]);
+                if ($cmp == 0) {  # it's identical. don't add it again.
+                    $inserted = 1;
+                    last;
+                }
+                elsif ($cmp == 1) { # it's lower priority (and different)
                     $self->update($entry,[$self->{status_attrib}],[$self->{STATUS_UNACQUIRED}]);
                     splice(@$entries, $i+1, 0, $entry);
                     $inserted = 1;
@@ -466,7 +472,8 @@
                     }
                     else {
                         $self->_release_resources($entry);
-                        $self->_maintain_queue_buffers("release",$entry);
+                        # the following line appears to have been a bug.
+                        #$self->_maintain_queue_buffers("release",$entry);
                     }
                 }
             }
@@ -484,7 +491,8 @@
                     }
                     else {
                         $self->_release_resources($entry);
-                        $self->_maintain_queue_buffers("release",$entry);
+                        # the following line appears to have been a bug
+                        #$self->_maintain_queue_buffers("release",$entry);
                     }
                 }
             }

Modified: p5ee/trunk/App-WorkQueue/lib/App/WorkQueue/Repository.pm
==============================================================================
--- p5ee/trunk/App-WorkQueue/lib/App/WorkQueue/Repository.pm	(original)
+++ p5ee/trunk/App-WorkQueue/lib/App/WorkQueue/Repository.pm	Mon Jun  5 16:18:12 2006
@@ -607,10 +607,10 @@
     $fh = \*STDOUT if (!$fh);
     print $fh "ENTRIES IN MEM:\n";
     $self->_print_entries_in_mem($fh);
-    if (!$no_db) {
-        print $fh "ENTRIES IN DB:\n";
-        $self->_print_entries_in_db($fh);
-    }
+    #if (!$no_db) {
+    #    print $fh "ENTRIES IN DB:\n";
+    #    $self->_print_entries_in_db($fh);
+    #}
     print $fh "CONSTRAINTS:\n";
     $self->print_constraints($fh);
     print $fh "STATUS COUNTS:\n";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.