debugging info for queueing notices

darcs-hash:20080704083216-34904-b170843a5fa73cb36ffb900be6f1bb56a08515d6.gz
This commit is contained in:
Evan Prodromou 2008-07-04 04:32:16 -04:00
parent 856f10baba
commit cec671443d

View File

@ -866,7 +866,7 @@ function common_save_replies($notice) {
function common_broadcast_notice($notice, $remote=false) { function common_broadcast_notice($notice, $remote=false) {
if (common_config('queue', 'enabled')) { if (common_config('queue', 'enabled')) {
# Do it later! # Do it later!
return common_enqueue_notice($notice); common_enqueue_notice($notice);
} else { } else {
return common_real_broadcast($notice, $remote); return common_real_broadcast($notice, $remote);
} }
@ -875,17 +875,23 @@ function common_broadcast_notice($notice, $remote=false) {
# Stick the notice on the queue # Stick the notice on the queue
function common_enqueue_notice($notice) { function common_enqueue_notice($notice) {
common_log(LOG_INFO, 'start queueing notice ID = ' . $notice->id); common_log(LOG_DEBUG, 'start queueing notice ID = ' . $notice->id);
$qi = new Queue_item(); $qi = new Queue_item();
common_log(LOG_DEBUG, 'got a new qi object');
$qi->notice_id = $notice->id; $qi->notice_id = $notice->id;
$qi->created = DB_DataObject_Cast::dateTime(); common_log(LOG_DEBUG, 'got a new id:' . $qi->notice_id);
$qi->created = $notice->created;
common_log(LOG_DEBUG, 'set created date');
common_log(LOG_DEBUG, print_r($qi, true));
$result = $qi->insert(); $result = $qi->insert();
if ($result === FALSE) { common_log(LOG_DEBUG, 'inserted');
if (!$result) {
$last_error = &PEAR::getStaticProperty('DB_DataObject','lastError'); $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
common_log(LOG_ERROR, 'DB error inserting queue item: ' . $last_error->message); common_log(LOG_ERROR, 'DB error inserting queue item: ' . $last_error->message);
return false; return false;
} }
common_log(LOG_INFO, 'complete queueing notice ID = ' . $notice->id); common_log(LOG_DEBUG, print_r($qi, true));
common_log(LOG_DEBUG, 'complete queueing notice ID = ' . $notice->id);
return $result; return $result;
} }