Exemplo n.º 1
0
 function distribute()
 {
     // We always insert for the author so they don't
     // have to wait
     Event::handle('StartNoticeDistribute', array($this));
     // If there's a failure, we want to _force_
     // distribution at this point.
     try {
         $json = json_encode((object) array('id' => $this->getID(), 'type' => 'Notice'));
         $qm = QueueManager::get();
         $qm->enqueue($json, 'distrib');
     } catch (Exception $e) {
         // If the exception isn't transient, this
         // may throw more exceptions as DQH does
         // its own enqueueing. So, we ignore them!
         try {
             $handler = new DistribQueueHandler();
             $handler->handle($this);
         } catch (Exception $e) {
             common_log(LOG_ERR, "emergency redistribution resulted in " . $e->getMessage());
         }
         // Re-throw so somebody smarter can handle it.
         throw $e;
     }
 }
Exemplo n.º 2
0
 function distribute()
 {
     // We always insert for the author so they don't
     // have to wait
     $user = User::staticGet('id', $this->profile_id);
     if (!empty($user)) {
         Inbox::insertNotice($user->id, $this->id);
     }
     if (common_config('queue', 'inboxes')) {
         // If there's a failure, we want to _force_
         // distribution at this point.
         try {
             $qm = QueueManager::get();
             $qm->enqueue($this, 'distrib');
         } catch (Exception $e) {
             // If the exception isn't transient, this
             // may throw more exceptions as DQH does
             // its own enqueueing. So, we ignore them!
             try {
                 $handler = new DistribQueueHandler();
                 $handler->handle($this);
             } catch (Exception $e) {
                 common_log(LOG_ERR, "emergency redistribution resulted in " . $e->getMessage());
             }
             // Re-throw so somebody smarter can handle it.
             throw $e;
         }
     } else {
         $handler = new DistribQueueHandler();
         $handler->handle($this);
     }
 }