Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Add retryUntil method to queued mailables #41393

Merged
merged 3 commits into from
Mar 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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