Created
August 18, 2022 15:35
-
-
Save spout/c93405e150aa15c237539d9ef19954b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Jobs\Traits; | |
trait ExponentialBackoffTrait | |
{ | |
/** | |
* @return \Carbon\Carbon | |
* @link https://medium.com/maatwebsite/laravel-and-murphys-law-e22731be31d9 | |
*/ | |
public function retryAfter() | |
{ | |
return now()->addSeconds( | |
(int) round(((2 ** $this->attempts()) - 1 ) / 2) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment