Skip to content

Commit

Permalink
fix serialization of rate limited middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 15, 2021
1 parent 19f338e commit f3d4dcb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Illuminate/Queue/Middleware/RateLimited.php
Expand Up @@ -120,4 +120,31 @@ protected function getTimeUntilNextRetry($key)
{
return $this->limiter->availableIn($key) + 3;
}

/**
* Prepare the object for serialization.
*
* @return array
*/
public function __serialize()
{
return [
'limiterName' => $this->limiterName,
'shouldRelease' => $this->shouldRelease,
];
}

/**
* Prepare the object after unserialization.
*
* @param array $data
* @return void
*/
public function __unserialize(array $data)
{
$this->limiter = Container::getInstance()->make(RateLimiter::class);

$this->limitedName = $data['limiterName'];
$this->shouldRelease = $data['shouldRelease'];
}
}

0 comments on commit f3d4dcb

Please sign in to comment.