本文整理汇总了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);
}
示例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());
}
示例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)]);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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));
}
示例8: pushFetchImagesQueue
private function pushFetchImagesQueue(User $user)
{
$job = new FetchImages($user->id);
$this->queue->later(rand(1, 900), $job);
}
示例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);
}
示例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);
}