-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add configurable behavior for cancelled get() calls #17
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
Conversation
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
|
Thanks for your contribution @Sh4d1! The ReturnToPool impl looks really good. I'm considering always returning the unready object to the pool if In this way, we expose less config options to users and reduce the learning burden. I think the most proper manner here is to return the unready_object to the pool. We may further merge UnreadyObject and Object. What do you think? |
|
I thought about it, but it really depends on the behaviour of If you think it's better to return to the pool everytime we can change to that behaviour 😄 |
Ah. Correct. Since Let's keep the current structure and I'll merge it in this week (ping me if I fail to merge it). The very last concern from my side is about naming and docs. |
|
Yeah I also find the naming a bit generic but couldn't find something else without having like DropBehaviourOnGet which is a bit of a mouthful 😅 |
|
@Sh4d1 I chose If you're OK with this, I'm going to merge this patch and release a |
|
Perfect ! Works for me 😄 thanks @tisonkun ! |
|
@Sh4d1 v1.1.0 has been released with this feature included. Feel free to test it out and I'd appreciate it if you can give the feedback :D |
|
Yay! I'll try to bump it next week on our side ! |
Fixes #16
When
pool.get()is cancelled (via atokio::time::timeoutfor instance) whileis_recyclable()is running, the object being validated is unconditionally detached from the pool.This patch introduces a
CancellationBehavioroption:Detach(default): Detach the object from the pool. This preserves existing behavior.ReturnToPool: Return the object to the pool for potential reuse.cc @tisonkun