aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-05-29 22:50:36 -0700
committerFriendika <info@friendika.com>2011-05-29 22:50:36 -0700
commit656d861b3ea83ff2acdc5e0c1c7bc3da86dc7c3a (patch)
tree74141ce982cd9a3a6df6212b5c208f10a839d599 /include/items.php
parentdd4d5707b0d230622323eb6e81bc6c6fb4c25d9a (diff)
downloadvolse-hubzilla-656d861b3ea83ff2acdc5e0c1c7bc3da86dc7c3a.tar.gz
volse-hubzilla-656d861b3ea83ff2acdc5e0c1c7bc3da86dc7c3a.tar.bz2
volse-hubzilla-656d861b3ea83ff2acdc5e0c1c7bc3da86dc7c3a.zip
on rare occasions posts do not get a parent. The only thing which could cause it is if we can't find our new post. So we'll check for this and try one more time before failing.
Diffstat (limited to 'include/items.php')
-rw-r--r--include/items.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index cbf5e4d24..fbcac30cd 100644
--- a/include/items.php
+++ b/include/items.php
@@ -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);