mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 03:25:15 +02:00
Increased performance when storing items
This commit is contained in:
parent
66bec9475d
commit
5fb2e47809
3 changed files with 74 additions and 13 deletions
|
@ -370,6 +370,13 @@ function uri_to_guid($uri) {
|
|||
|
||||
function item_store($arr,$force_parent = false, $notify = false, $dontcache = false) {
|
||||
|
||||
$perfdb = $a->performance["database"];
|
||||
$perfdbw = $a->performance["database_write"];
|
||||
$perfnet = $a->performance["network"];
|
||||
$perffile = $a->performance["file"];
|
||||
|
||||
logger("Performance: Start", LOGGER_DEBUG);
|
||||
|
||||
// If it is a posting where users should get notifications, then define it as wall posting
|
||||
if ($notify) {
|
||||
$arr['wall'] = 1;
|
||||
|
@ -914,6 +921,14 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
add_shadow_entry($arr);
|
||||
}
|
||||
|
||||
$perfdb = $a->performance["database"] - $perfdb;
|
||||
$perfdbw = $a->performance["database_write"] - $perfdbw;
|
||||
$perfnet = $a->performance["network"] - $perfnet;
|
||||
$perffile = $a->performance["file"] - $perffile;
|
||||
|
||||
logger("Performance: DB-R: ".round($perfdb - $perfdbw, 2)." - DB-W: ".round($perfdbw, 2)." - Net: ".round($perfnet, 2)." - File: ".round($perffile, 2), LOGGER_DEBUG);
|
||||
//logger("Performance: DB-R: ".round($perfdb - $perfdbw, 2)." - DB-W: ".round($perfdbw, 2)." - Net: ".round($perfnet, 2), LOGGER_DEBUG);
|
||||
|
||||
check_item_notification($current_post, $uid);
|
||||
|
||||
if ($notify)
|
||||
|
|
|
@ -135,7 +135,9 @@ function update_thread($itemid, $setmention = false) {
|
|||
$sql .= "`".$field."` = '".dbesc($data)."'";
|
||||
}
|
||||
|
||||
logger("Pre Update Thread", LOGGER_DEBUG);
|
||||
$result = q("UPDATE `thread` SET ".$sql." WHERE `iid` = %d", intval($itemid));
|
||||
logger("Post Update Thread", LOGGER_DEBUG);
|
||||
|
||||
logger("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".print_r($result, true)." ".print_r($item, true), LOGGER_DEBUG);
|
||||
|
||||
|
@ -145,6 +147,7 @@ function update_thread($itemid, $setmention = false) {
|
|||
if (!$items)
|
||||
return;
|
||||
|
||||
logger("Pre Update Item", LOGGER_DEBUG);
|
||||
$result = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d",
|
||||
dbesc($item["title"]),
|
||||
dbesc($item["body"]),
|
||||
|
@ -152,6 +155,7 @@ function update_thread($itemid, $setmention = false) {
|
|||
dbesc($item["rendered-hash"]),
|
||||
intval($items[0]["id"])
|
||||
);
|
||||
logger("Post Update Item", LOGGER_DEBUG);
|
||||
logger("Updating public shadow for post ".$items[0]["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue