當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Queue::later方法代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Queue\Queue::later方法的典型用法代碼示例。如果您正苦於以下問題:PHP Queue::later方法的具體用法?PHP Queue::later怎麽用?PHP Queue::later使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Contracts\Queue\Queue的用法示例。


在下文中一共展示了Queue::later方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: later

 /**
  * Push a new job onto the queue after a delay.
  *
  * @param  \DateTime|int $delay
  * @param  string $job
  * @param  mixed $data
  * @param  string $queue
  * @return mixed
  */
 public function later($delay, $job, $data = '', $queue = null)
 {
     if ($this->isLongTerm($delay)) {
         return $this->longTermQueue->later($this->longTermDelay($delay), new HybridJob($job, $data, $this->shortTermDelay($delay), $this->shortTermConnection, $queue), '', $queue);
     }
     return $this->shortTermQueue->later($delay, $job, $data, $queue);
 }
開發者ID:halaei,項目名稱:hybrid-queue,代碼行數:16,代碼來源:HybridQueue.php

示例2: queue

 /**
  * @param JobDescription $job
  *
  * @return void
  */
 protected function queue(JobDescription $job)
 {
     if ($this->disabled) {
         return;
     }
     if ($job->isDelayed()) {
         return $this->queue->later($job->getDelay(), $job->getClass(), $job->getPayload(), $job->getQueue());
     }
     return $this->queue->push($job->getClass(), $job->getPayload(), $job->getQueue());
 }
開發者ID:arrounded,項目名稱:queues,代碼行數:15,代碼來源:Queues.php

示例3: pushCommandToQueue

 /**
  * Push the command onto the given queue instance.
  *
  * @param  \Illuminate\Contracts\Queue\Queue  $queue
  * @param  mixed  $command
  * @return mixed
  */
 protected function pushCommandToQueue($queue, $command)
 {
     if (isset($command->queue, $command->delay)) {
         return $queue->laterOn($command->queue, $command->delay, $command);
     }
     if (isset($command->queue)) {
         return $queue->pushOn($command->queue, $command);
     }
     if (isset($command->delay)) {
         return $queue->later($command->delay, $command);
     }
     return $queue->push('Ahead4\\Bus\\CallQueuedHandler@call', ['pipes' => $this->pipes, 'command' => serialize($command)]);
 }
開發者ID:ahead4,項目名稱:bus,代碼行數:20,代碼來源:Dispatcher.php

示例4: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle(Container $app, Queue $queue)
 {
     $imgurIds = $this->user->logs->lists('imgur_id');
     $imgurToken = $this->user->imgurToken;
     // Setup Imgur Service
     $imgur = $app->make('ImguBox\\Services\\ImgurService');
     $imgur->setUser($this->user);
     $imgur->setToken($imgurToken);
     $difference = $imgurToken->updated_at->diffInSeconds();
     // Imgur acccess_token expires after 3600 seconds
     if ($difference >= 3500) {
         $refreshedToken = $imgur->refreshToken();
         if (property_exists($refreshedToken, 'success') && $refreshedToken->success === false) {
             return $this->error('something went wrong');
         }
         $imgurToken->token = \Crypt::encrypt($refreshedToken->access_token);
         $imgurToken->save();
     }
     $imgur->setToken($imgurToken);
     $favorites = $imgur->favorites();
     if (is_array($favorites)) {
         // Remove models we already processed
         $favorites = collect($favorites)->reject(function ($object) use($imgurIds) {
             return in_array($object->id, $imgurIds);
         });
         foreach ($favorites as $favorite) {
             Cache::put("user:{$this->user->id}:favorite:{$favorite->id}", $favorite, 10);
             $job = new StoreImages($this->user->id, $favorite->id);
             $queue->later(rand(1, 900), $job);
         }
     } elseif (property_exists($favorites, 'error')) {
         Mail::send('emails.api-error', [], function ($message) {
             $message->to($this->user->email)->subject("ImguBox can no longer synx your Imgur favorites. Action needed.");
         });
         // Delete ImgurToken.
         $imgurToken->delete();
     }
 }
開發者ID:syamantak,項目名稱:imgubox,代碼行數:43,代碼來源:FetchImages.php

示例5: pushCommandToQueue

 /**
  * Push the command onto the given queue instance.
  *
  * @param  \Illuminate\Contracts\Queue\Queue  $queue
  * @param  mixed  $command
  * @return mixed
  */
 protected function pushCommandToQueue($queue, $command)
 {
     if (isset($command->queue, $command->delay)) {
         return $queue->laterOn($command->queue, $command->delay, $command);
     }
     if (isset($command->queue)) {
         return $queue->pushOn($command->queue, $command);
     }
     if (isset($command->delay)) {
         return $queue->later($command->delay, $command);
     }
     return $queue->push($command);
 }
開發者ID:focuslife,項目名稱:v0.1,代碼行數:20,代碼來源:Dispatcher.php

示例6: later

 /**
  * Queue a new e-mail message for sending after (n) seconds.
  *
  * @param  int  $delay
  * @param  string|array  $view
  * @param  array  $data
  * @param  \Closure|string  $callback
  * @param  string|null  $queue
  * @return mixed
  */
 public function later($delay, $view, array $data, $callback, $queue = null)
 {
     $callback = $this->buildQueueCallable($callback);
     return $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
 }
開發者ID:riopurwanggono,項目名稱:boombazaar,代碼行數:15,代碼來源:Mailer.php

示例7: startCooldown

 /**
  * @param $email
  */
 protected function startCooldown($email)
 {
     $seconds = $this->config->get('users.auth.throttling_interval');
     $delay = $this->carbon->now()->addSeconds($seconds);
     $this->queue->later($delay, new Cooldown($this->ip, $email));
 }
開發者ID:jaffle-be,項目名稱:framework,代碼行數:9,代碼來源:ThrottleManager.php

示例8: pushFetchImagesQueue

 private function pushFetchImagesQueue(User $user)
 {
     $job = new FetchImages($user->id);
     $this->queue->later(rand(1, 900), $job);
 }
開發者ID:janusnic,項目名稱:imgubox,代碼行數:5,代碼來源:FetchUserFavs.php

示例9: later

 /**
  * Queue a new e-mail message for sending after (n) seconds.
  *
  * @param  int  $delay
  * @param  array  $data
  * @param  \Closure|string  $callback
  * @param  string|null  $queue
  * @return mixed
  */
 public function later($delay, $recepient, $message, $queue = null)
 {
     $callback = ['recepient' => $recepient, 'message' => $message, 'sender' => isset($sender) ? $sender : null, 'message_type' => isset($message_type) ? $message_type : 0];
     return $this->queue->later($delay, 'sms@handleQueuedMessage', $callback, $queue);
 }
開發者ID:adetoola,項目名稱:sms,代碼行數:14,代碼來源:SMS.php

示例10: later

 /**
  * Queue a new message for sending after (n) seconds.
  *
  * @param  int  $delay
  * @param  \Closure|string  $callback
  * @param  string  $queue
  *
  * @return mixed
  */
 public function later($delay, $callback, $queue = null)
 {
     $callback = $this->buildQueueCallable($callback);
     return $this->queue->later($delay, 'messenger@handleQueuedMessage', compact('callback'), $queue);
 }
開發者ID:nathanmac,項目名稱:instant-messenger,代碼行數:14,代碼來源:Messenger.php


注:本文中的Illuminate\Contracts\Queue\Queue::later方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。