Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

handling of multiple transactions #105

Closed
wants to merge 3 commits into from
Closed

handling of multiple transactions #105

wants to merge 3 commits into from

Conversation

cvlmtg
Copy link
Contributor

@cvlmtg cvlmtg commented Apr 15, 2014

Hi, with regard to the issue #104 I've tried this change to put multiple transaction in queue rather than mixing them as it happens now.
I'm not sure if this might impact existing applications, but to be honest I think that mixing transaction is wrong in the first place (and as I've reported it may lead to errors) so I dare to say my approach should be the right one :)

Transactions are queued unless { savepoint: true } is specified. In this case everything should work as expected. I suppose that queuing might have a slight performance hit, but I think it's preferable to an unexpected result. I've thought about making them run in parallel, but I've currently no idea how to achieve that without possibily changing the API. Given the fact that it would also be quite a difficult task and I don't have enough time to devote to it right now, I'll leave it for a better time

I'm not an ORM expert, so feel free to review and improve my code :)
Thanks for your work with patio.

cvlmtg and others added 3 commits April 11, 2014 23:15
let's avoid running a transaction inside another one.
unless { savepoint: true } is specified, a transaction
is isolated from the others. NOTE: needs more testing
@cvlmtg
Copy link
Contributor Author

cvlmtg commented Apr 16, 2014

oh nice, I see now the travis build error... I'll see if I can fix it.

@cvlmtg
Copy link
Contributor Author

cvlmtg commented Apr 16, 2014

ok, if I set useTransactions to false by default, all the test passes. I disabled it when writing my app and forgot about that soon after...

Anyway, as I don't yet fully know patio inner working logic, I'm not sure how to fix this. I still think that mixing different queries in the same transaction is conceptually wrong and, as you said, confusing. I'll see if I can find a solution to this issue while allowing to create automatically a transaction when saving or updating more models at once.

@cvlmtg cvlmtg closed this Apr 16, 2014
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.

1 participant