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

Using coroutines with multiple databases #624

Closed
anthony-tarr opened this issue Aug 15, 2019 · 2 comments
Closed

Using coroutines with multiple databases #624

anthony-tarr opened this issue Aug 15, 2019 · 2 comments

Comments

@anthony-tarr
Copy link

anthony-tarr commented Aug 15, 2019

I'm attempting to do something like the following:

newSuspendedTransaction(Dispatchers.IO, db1) {
  val user = repo1.getUserFromUUID(uuid)

  ...

  newSuspendedTransaction(Dispatchers.IO, db2) {
    val newUser = repo2.createUser(user.email)
    repo2.createPassword(newUser, password)
  }

  ...
}

The reason why both are newSuspendedTransaction is because I'm abstracting the transaction out of the repo. But I have no way to manually reach into the existing Transaction or fetch the TransactionScope directly.

But the second transaction doesn't execute in the correct database. I've verified it's passed in correctly.

Am I using the coroutine helpers correctly, or is there another workaround?

@Tapac
Copy link
Contributor

Tapac commented Aug 16, 2019

fixed in 0.16.4, please try it.

@Tapac Tapac closed this as completed Aug 16, 2019
@anthony-tarr
Copy link
Author

Works now, thanks!

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

No branches or pull requests

2 participants