]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Revert "Revert "don't insert the same notice twice into an inbox""
authorEvan Prodromou <evan@status.net>
Thu, 1 Apr 2010 16:57:52 +0000 (12:57 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 1 Apr 2010 16:57:52 +0000 (12:57 -0400)
This reverts commit a09b27ff41df41a86fdb0abae14239907d5ee6ec.

classes/Inbox.php

index 014ba3d82923efb70d07fe0b70137fba726ee99c..0d807946d57cad6297e8e2610f124597e97f0006 100644 (file)
@@ -114,6 +114,16 @@ class Inbox extends Memcached_DataObject
             return false;
         }
 
+        $ids = unpack('N*', $inbox->notice_ids);
+
+        // bulk inserts sometimes fail and get restarted.
+        // Skip if this one has been inserted before.
+
+        if (in_array($notice_id, $ids)) {
+            // effectively successful
+            return true;
+        }
+
         $result = $inbox->query(sprintf('UPDATE inbox '.
                                         'set notice_ids = concat(cast(0x%08x as binary(4)), '.
                                         'substr(notice_ids, 1, %d)) '.