We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
NewCrate::save_new_crate()
1 parent 73c7629 commit 8c1e803Copy full SHA for 8c1e803
src/models/krate.rs
@@ -105,7 +105,7 @@ impl<'a> NewCrate<'a> {
105
conn.transaction(|conn| {
106
// To avoid race conditions, we try to insert
107
// first so we know whether to add an owner
108
- if let Some(krate) = self.save_new_crate(conn, uploader)? {
+ if let Some(krate) = conn.transaction(|conn| self.create(conn, uploader).optional())? {
109
return Ok(krate);
110
}
111
@@ -148,10 +148,6 @@ impl<'a> NewCrate<'a> {
148
Ok(krate)
149
})
150
151
-
152
- fn save_new_crate(&self, conn: &mut PgConnection, user_id: i32) -> QueryResult<Option<Crate>> {
153
- conn.transaction(|conn| self.create(conn, user_id).optional())
154
- }
155
156
157
impl Crate {
0 commit comments