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

Pooling for asynchronous view #8

Open
harshalizode opened this issue May 22, 2024 · 4 comments
Open

Pooling for asynchronous view #8

harshalizode opened this issue May 22, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@harshalizode
Copy link

Hello,

I used the Pondpond library with the synchronous view at first, then after changing the request, I got the asynchronous view.

We have sync methods for the PooledObjectFactory; is there a way to make them async so that we can implement pooling without modifying to the other libraries?

Thank you

@T-baby
Copy link
Owner

T-baby commented May 22, 2024

Do you need a PooledObjectFactory that supports async methods?

class PooledDogFactory(PooledObjectFactory):
    async def createInstance(self) -> PooledObject:
        dog = Dog()
        dog.name = "puppy"
        return PooledObject(dog)

    async  def destroy(self, pooled_object: PooledObject):
        del pooled_object

    async  def reset(self, pooled_object: PooledObject) -> PooledObject:
        pooled_object.keeped_object.name = "puppy"
        return pooled_object

    async def validate(self, pooled_object: PooledObject) -> bool:
        return pooled_object.keeped_object.validate_result

@harshalizode
Copy link
Author

Yes, absolutely right.
We have this feature to implement with Asynchronous view?

@T-baby
Copy link
Owner

T-baby commented May 24, 2024

This feature may be added in the next version.

@T-baby T-baby self-assigned this May 24, 2024
@T-baby T-baby added the enhancement New feature or request label May 24, 2024
@harshalizode
Copy link
Author

Okay, Thank you, I appreciate your amazing reaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants