Skip to content

Commit

Permalink
[9.x] Add retryUntil method to queued mailables (#41393)
Browse files Browse the repository at this point in the history
* Add retryUntil method to queued mailables

* Update src/Illuminate/Mail/SendQueuedMailable.php

Co-authored-by: Mark Beech <[email protected]>

* Update SendQueuedMailable.php

Co-authored-by: Mark Beech <[email protected]>
Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
3 people authored Mar 8, 2022
1 parent 8ca43f4 commit 8b0f9f1
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/Illuminate/Mail/SendQueuedMailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,31 @@ public function handle(MailFactory $factory)
}

/**
* Get the display name for the queued job.
* Get the number of seconds before a released mailable will be available.
*
* @return string
* @return mixed
*/
public function displayName()
public function backoff()
{
return get_class($this->mailable);
if (! method_exists($this->mailable, 'backoff') && ! isset($this->mailable->backoff)) {
return;
}

return $this->mailable->backoff ?? $this->mailable->backoff();
}

/**
* Get the expiration for the mailable.
*
* @return mixed
*/
public function retryUntil()
{
if (! method_exists($this->mailable, 'retryUntil') && ! isset($this->mailable->retryUntil)) {
return;
}

return $this->mailable->retryUntil ?? $this->mailable->retryUntil();
}

/**
Expand All @@ -89,17 +107,13 @@ public function failed($e)
}

/**
* Get the number of seconds before a released mailable will be available.
* Get the display name for the queued job.
*
* @return mixed
* @return string
*/
public function backoff()
public function displayName()
{
if (! method_exists($this->mailable, 'backoff') && ! isset($this->mailable->backoff)) {
return;
}

return $this->mailable->backoff ?? $this->mailable->backoff();
return get_class($this->mailable);
}

/**
Expand Down

0 comments on commit 8b0f9f1

Please sign in to comment.