当前位置: 首页>>代码示例>>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;未经允许,请勿转载。