-
Notifications
You must be signed in to change notification settings - Fork 74
Surround Transfer retrieval after insert with transaction #219
Conversation
506cedb
to
a935730
Compare
|> changeset(attrs) | ||
|> do_insert(opts) | ||
|> case do | ||
{_, res} -> res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the new return types cause problem? E.g. before, it would return {:ok, result}
or changeset
. Now it's {:ok, result}
or {:error, changeset}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insert
actually returns {:error, changeset}
, here it's just shortcuted to changeset
. Insert doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry changeset
made me immediately thought it's returning %Ecto.Changeset{}
. Ignore me.
|> changeset(attrs) | ||
|> do_insert(opts) | ||
|> case do | ||
{_, res} -> res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry changeset
made me immediately thought it's returning %Ecto.Changeset{}
. Ignore me.
a935730
to
8c026e2
Compare
8c026e2
to
6a568a6
Compare
Issue/Task Number: T347
Overview
Since we have multiple nodes of the DB, there seem to be some randomly failing method in the Transfer insert flow. Basically, the retrieval after the insert fails because the record was "potentially" inserted in another node. This PR surrounds the insert/get flow with a transaction as an attempt to fix that.
Changes
Repo.transaction()
around ininsert