Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Add AsyncObjectPool.use to combine take and giveBack #53

Merged
merged 1 commit into from
Oct 31, 2013

Conversation

dylex
Copy link
Contributor

@dylex dylex commented Oct 29, 2013

This seems like a common use case, and as long as the provided function doesn't hold onto the provided item it should be safe. Is this reasonable? Is it sufficiently non-trivial for addition? It eliminates duplicate code in ConnectionPool.

I'm working up to writing a withTransaction-like function but want to make sure I'm on the right track.

@mauricio
Copy link
Owner

This is great 👍

Gonna run some tests and merge this, thanks @dylex !

@dylex
Copy link
Contributor Author

dylex commented Oct 30, 2013

890a2f8 is a inTransaction function that wraps a function in BEGIN/COMMIT (or ROLLBACK on error), and works both for simple Connection and ConnectionPool, if you're interested in that as well. I'm not super happy about the types needed for both uses to agree. Tested manually on postgres in simple and error conditions, but not mysql at all. I'll try to get the test suite to work so I can write some tests for postgres anyway.

@mauricio
Copy link
Owner

Can you make the transaction stuff into a separate PR?

I think there could be a better workflow for it.

@dylex
Copy link
Contributor Author

dylex commented Oct 30, 2013

Sure. I had just pushed to my branch -- didn't realize it would automatically get added.

mauricio added a commit that referenced this pull request Oct 31, 2013
Add AsyncObjectPool.use to combine take and giveBack
@mauricio mauricio merged commit 055d051 into mauricio:master Oct 31, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants