forked from GNUsocial/gnu-social
Fix memory leak in Inbox::addToInbox() (usage of raw DB_DataObject::staticGet, which leaks memory into a process-global cache).
On my test setup, this fixes inbox delivery to 10,000 local recipients from background queuedaemon running with a 32mb memory limit, completes the job within a minute from start.
This commit is contained in:
parent
634752f0d2
commit
17ab15a3d0
@ -115,9 +115,12 @@ class Inbox extends Memcached_DataObject
|
|||||||
*/
|
*/
|
||||||
static function insertNotice($user_id, $notice_id)
|
static function insertNotice($user_id, $notice_id)
|
||||||
{
|
{
|
||||||
$inbox = DB_DataObject::staticGet('inbox', 'user_id', $user_id);
|
// Going straight to the DB rather than trusting our caching
|
||||||
|
// during an update. Note: not using DB_DataObject::staticGet,
|
||||||
if (empty($inbox)) {
|
// which is unsafe to use directly (in-process caching causes
|
||||||
|
// memory leaks, which accumulate in queue processes).
|
||||||
|
$inbox = new Inbox();
|
||||||
|
if (!$inbox->get('user_id', $user_id)) {
|
||||||
$inbox = Inbox::initialize($user_id);
|
$inbox = Inbox::initialize($user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user