]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix to make blowing of replies stream cache more consistent when receiving replies...
authorBrion Vibber <brion@pobox.com>
Fri, 23 Apr 2010 13:55:46 +0000 (06:55 -0700)
committerBrion Vibber <brion@pobox.com>
Fri, 23 Apr 2010 13:55:46 +0000 (06:55 -0700)
classes/Notice.php
classes/Reply.php

index 4cf12fc6f9f77cda6d2ed77796a8bf156800ef46..c4a3168881a623486eb9780c3a7800c840dbec87 100644 (file)
@@ -985,8 +985,6 @@ class Notice extends Memcached_DataObject
                 $reply->profile_id = $user->id;
 
                 $id = $reply->insert();
-
-                self::blow('reply:stream:%d', $user->id);
             }
         }
 
@@ -1052,6 +1050,7 @@ class Notice extends Memcached_DataObject
                     throw new ServerException("Couldn't save reply for {$this->id}, {$mentioned->id}");
                 } else {
                     $replied[$mentioned->id] = 1;
+                    self::blow('reply:stream:%d', $mentioned->id);
                 }
             }
         }
@@ -1107,7 +1106,6 @@ class Notice extends Memcached_DataObject
         foreach ($recipientIds as $recipientId) {
             $user = User::staticGet('id', $recipientId);
             if (!empty($user)) {
-                self::blow('reply:stream:%d', $recipientId);
                 mail_notify_attn($user, $this);
             }
         }
index 659e04c9253934ad82dad90b0cd2ce4d198b32f5..dc6296bda347b9f78e8e31fa856a5f1c7681670c 100644 (file)
@@ -22,6 +22,20 @@ class Reply extends Memcached_DataObject
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
+    /**
+     * Wrapper for record insertion to update related caches
+     */
+    function insert()
+    {
+        $result = parent::insert();
+
+        if ($result) {
+            self::blow('reply:stream:%d', $this->profile_id);
+        }
+
+        return $result;
+    }
+
     function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0)
     {
         $ids = Notice::stream(array('Reply', '_streamDirect'),