You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to insert many values into a database as quickly as possible.
These values are requested from an external API.
In order to efficiently request the data from the external API, I'm using futures::Stream to perform the many requests in parallel.
I then use the same stream to also efficiently (I believe) insert the data into the database.
I would also like to wrap this in a transaction so that the data is not updated when an error occurs, however when I try to use the Transaction I run into issues.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to insert many values into a database as quickly as possible.
These values are requested from an external API.
In order to efficiently request the data from the external API, I'm using
futures::Stream
to perform the many requests in parallel.I then use the same stream to also efficiently (I believe) insert the data into the database.
I would also like to wrap this in a transaction so that the data is not updated when an error occurs, however when I try to use the
Transaction
I run into issues.Please see the following example code:
Is there a way to make this work with a transaction?
Do I need to restructure my code for this?
Beta Was this translation helpful? Give feedback.
All reactions