diff options
author | Evan Prodromou <evan@status.net> | 2009-12-08 16:30:33 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-12-08 16:30:33 -0500 |
commit | 72c82a2e293549c10b60ca9e295f2f430224e814 (patch) | |
tree | 237dcadc7369978aa2c72b1401b573a3c0d9f81b /classes/Notice.php | |
parent | 6bc6af667ec51e41570e580de43eac1f9e155d30 (diff) |
Basic function to store forwards and redistribute
Diffstat (limited to 'classes/Notice.php')
-rw-r--r-- | classes/Notice.php | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index 661072156..bcd7947bd 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -948,39 +948,7 @@ class Notice extends Memcached_DataObject } } - $cnt = 0; - - $qryhdr = 'INSERT INTO notice_inbox (user_id, notice_id, source, created) VALUES '; - $qry = $qryhdr; - - foreach ($ni as $id => $source) { - if ($cnt > 0) { - $qry .= ', '; - } - $qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') "; - $cnt++; - if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) { - // FIXME: Causes lag in replicated servers - // Notice_inbox::gc($id); - } - if ($cnt >= MAX_BOXCARS) { - $inbox = new Notice_inbox(); - $result = $inbox->query($qry); - if (PEAR::isError($result)) { - common_log_db_error($inbox, $qry); - } - $qry = $qryhdr; - $cnt = 0; - } - } - - if ($cnt > 0) { - $inbox = new Notice_inbox(); - $result = $inbox->query($qry); - if (PEAR::isError($result)) { - common_log_db_error($inbox, $qry); - } - } + Notice_inbox::bulkInsert($this->id, $this->created, $ni); return; } |