]> git.mxchange.org Git - friendica.git/commitdiff
on rare occasions posts do not get a parent. The only thing which could cause it...
authorFriendika <info@friendika.com>
Mon, 30 May 2011 05:50:36 +0000 (22:50 -0700)
committerFriendika <info@friendika.com>
Mon, 30 May 2011 05:50:36 +0000 (22:50 -0700)
addon/facebook/facebook.php
include/items.php

index b1ba6342ad4f5c1bf7814c8d9b97d3cee5d4b8e4..dc1aa02dd9f95660793c0e5abb47c24e4f934c45 100644 (file)
@@ -725,8 +725,10 @@ function fb_consume_stream($uid,$j,$wall = false) {
 
                        // don't store post if we don't have a contact
 
-                       if(! x($datarray,'contact-id'))
+                       if(! x($datarray,'contact-id')) {
+                               logger('no contact: post ignored');
                                continue; 
+                       }
 
                        $datarray['verb'] = ACTIVITY_POST;                                              
                        if($wall) {
@@ -759,8 +761,10 @@ function fb_consume_stream($uid,$j,$wall = false) {
                                intval($top_item),
                                intval($uid)
                        );                      
-                       if(count($r))
+                       if(count($r)) {
                                $orig_post = $r[0];
+                               logger('fb: new top level item posted');
+                       }
                }
 
                if(isset($entry->likes) && isset($entry->likes->data))
index cbf5e4d24dd49113514f0d86e6cf8355fae18642..fbcac30cdfa92ad403fab450522faa6708ba8279 100644 (file)
@@ -742,6 +742,15 @@ function item_store($arr,$force_parent = false) {
                $arr['uri'],           // already dbesc'd
                intval($arr['uid'])
        );
+       if(! count($r)) {
+               // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again. 
+               sleep(3);
+               $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                       $arr['uri'],           // already dbesc'd
+                       intval($arr['uid'])
+               );
+       }
+
        if(count($r)) {
                $current_post = $r[0]['id'];
                logger('item_store: created item ' . $current_post);