Skip to content

Commit 4c14945

Browse files
committed
fix: use another table name to avoid contention (but maybe it should be synchronized)
1 parent f082861 commit 4c14945

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/transactions.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async fn commit_with_serialization_failure_already_ends_transaction() {
114114
use tokio::sync::Barrier;
115115

116116
table! {
117-
users3 {
117+
users4 {
118118
id -> Integer,
119119
}
120120
}
@@ -139,7 +139,7 @@ async fn commit_with_serialization_failure_already_ends_transaction() {
139139

140140
let mut conn1 = super::connection_without_transaction().await;
141141

142-
diesel::sql_query("CREATE TABLE IF NOT EXISTS users3 (id int);")
142+
diesel::sql_query("CREATE TABLE IF NOT EXISTS users4 (id int);")
143143
.execute(&mut conn)
144144
.await
145145
.unwrap();
@@ -155,11 +155,11 @@ async fn commit_with_serialization_failure_already_ends_transaction() {
155155

156156
let res = tx.run(|conn| {
157157
Box::pin(async {
158-
users3::table.select(users3::id).load::<i32>(conn).await?;
158+
users4::table.select(users4::id).load::<i32>(conn).await?;
159159

160160
barrier_1_for_tx1.wait().await;
161-
diesel::insert_into(users3::table)
162-
.values(users3::id.eq(1))
161+
diesel::insert_into(users4::table)
162+
.values(users4::id.eq(1))
163163
.execute(conn)
164164
.await?;
165165
barrier_2_for_tx1.wait().await;
@@ -174,11 +174,11 @@ async fn commit_with_serialization_failure_already_ends_transaction() {
174174
let res = tx1
175175
.run(|conn| {
176176
Box::pin(async {
177-
users3::table.select(users3::id).load::<i32>(conn).await?;
177+
users4::table.select(users4::id).load::<i32>(conn).await?;
178178

179179
barrier_1_for_tx2.wait().await;
180-
diesel::insert_into(users3::table)
181-
.values(users3::id.eq(1))
180+
diesel::insert_into(users4::table)
181+
.values(users4::id.eq(1))
182182
.execute(conn)
183183
.await?;
184184

0 commit comments

Comments
 (0)