summaryrefslogtreecommitdiff
path: root/classes/Queue_item.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Queue_item.php')
-rw-r--r--classes/Queue_item.php60
1 files changed, 30 insertions, 30 deletions
diff --git a/classes/Queue_item.php b/classes/Queue_item.php
index 8ba3281de..e54b4976b 100644
--- a/classes/Queue_item.php
+++ b/classes/Queue_item.php
@@ -22,34 +22,34 @@ class Queue_item extends Memcached_DataObject
###END_AUTOCODE
function sequenceKey() { return array(false, false); }
-
- static function top($transport) {
-
- $qi = new Queue_item();
- $qi->transport = $transport;
- $qi->orderBy('created');
- $qi->whereAdd('claimed is NULL');
-
- $qi->limit(1);
-
- $cnt = $qi->find(TRUE);
-
- if ($cnt) {
- # XXX: potential race condition
- # can we force it to only update if claimed is still NULL
- # (or old)?
- common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
- $orig = clone($qi);
- $qi->claimed = common_sql_now();
- $result = $qi->update($orig);
- if ($result) {
- common_log(LOG_INFO, 'claim succeeded.');
- return $qi;
- } else {
- common_log(LOG_INFO, 'claim failed.');
- }
- }
- $qi = NULL;
- return NULL;
- }
+
+ static function top($transport) {
+
+ $qi = new Queue_item();
+ $qi->transport = $transport;
+ $qi->orderBy('created');
+ $qi->whereAdd('claimed is NULL');
+
+ $qi->limit(1);
+
+ $cnt = $qi->find(TRUE);
+
+ if ($cnt) {
+ # XXX: potential race condition
+ # can we force it to only update if claimed is still NULL
+ # (or old)?
+ common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
+ $orig = clone($qi);
+ $qi->claimed = common_sql_now();
+ $result = $qi->update($orig);
+ if ($result) {
+ common_log(LOG_INFO, 'claim succeeded.');
+ return $qi;
+ } else {
+ common_log(LOG_INFO, 'claim failed.');
+ }
+ }
+ $qi = NULL;
+ return NULL;
+ }
}