diff options
author | Evan Prodromou <evan@status.net> | 2010-03-31 15:54:35 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-03-31 15:54:35 -0400 |
commit | 650074c648d98f81674c6e2b0ebf052c473ada6e (patch) | |
tree | dd98d082267abf41c3abbd4703221a4bf25fa484 | |
parent | d3f995846b2a849bc53eb965eb2607d8d1d6dd34 (diff) |
don't insert the same notice twice into an inbox
-rw-r--r-- | classes/Inbox.php | 10 |
1 files changed, 10 insertions, 0 deletions
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)) '. |