Skip to content

Conversation

@lohanidamodar
Copy link
Contributor

No description provided.

public function delegate(string $method, array $args): mixed
{
return $this->pool->use(function (Redis $redis) use ($method, $args) {
$adapter = new RedisAdapter($this->key, $this->limit, $this->seconds, $redis);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instantiate the adapter in the pool init function instead? This way, we instantiate a new adapter for every call

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not see a clear path to implement it that way in the init function creating a pool of timeLimit :(

Copy link

@basert basert May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not gonna work. The adapters set the $count on the instance, if you create a new instance for every call, it's always gonna be 0.

We can't use the proxy approach here, you need to refactor the adapters to take a pool itself instead of wrapping them.

@lohanidamodar lohanidamodar requested a review from abnegate May 20, 2025 06:28
@lohanidamodar lohanidamodar requested a review from basert May 21, 2025 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants