From 9efe5393ff3f6a23fae1e32e521c6afe69eef6f6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 1 Apr 2010 12:57:52 -0400 Subject: Revert "Revert "don't insert the same notice twice into an inbox"" This reverts commit a09b27ff41df41a86fdb0abae14239907d5ee6ec. --- classes/Inbox.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/classes/Inbox.php b/classes/Inbox.php index 014ba3d82..0d807946d 100644 --- a/classes/Inbox.php +++ b/classes/Inbox.php @@ -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)) '. -- cgit v1.2.3-54-g00ecf