]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix for bug #2382: releasing claim on failed queue item works again with DB-based...
authorBrion Vibber <brion@pobox.com>
Sat, 26 Jun 2010 19:07:32 +0000 (15:07 -0400)
committerBrion Vibber <brion@pobox.com>
Sat, 26 Jun 2010 19:07:32 +0000 (15:07 -0400)
Warning: DB-based queue doesn't currently implement discarding of items after a retry limit. Failed items will be retried until they succeed.

classes/Queue_item.php
lib/dbqueuemanager.php

index f83c2cef184d49f868d712a82a016fefa34d4c68..c7e17be6e84556d56e9e55360e7aed483a274b1d 100644 (file)
@@ -64,4 +64,17 @@ class Queue_item extends Memcached_DataObject
         $qi = null;
         return null;
     }
+
+    /**
+     * Release a claimed item.
+     */
+    function releaseCLaim()
+    {
+        // DB_DataObject doesn't let us save nulls right now
+        $sql = sprintf("UPDATE queue_item SET claimed=NULL WHERE id=%d", $this->id);
+        $this->query($sql);
+
+        $this->claimed = null;
+        $this->encache();
+    }
 }
index 3032e4ec7a89cc4544e830bc25bb6726e458eabd..3dda9fd1ac8dd14865ef4ccfee486663e73b07e4 100644 (file)
@@ -135,9 +135,7 @@ class DBQueueManager extends QueueManager
         if (empty($qi->claimed)) {
             $this->_log(LOG_WARNING, "[$queue:item $qi->id] Ignoring failure for unclaimed queue item");
         } else {
-            $orig = clone($qi);
-            $qi->claimed = null;
-            $qi->update($orig);
+            $qi->releaseClaim();
         }
 
         $this->stats('error', $queue);