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

fix: serialization errors #414

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/model/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,11 @@ pub async fn upsert_subscription_watcher(
let start = Instant::now();
let mut txn = postgres.begin().await?;
// https://stackoverflow.com/a/48730873
sqlx::query::<Postgres>("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE") // TODO serialization errors not handled
.execute(&mut *txn)
.await?;
// Allow phantom reads; going above the watcher limit is not a big deal and handling
// serialization errors is not worth the effort

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this code be removed instead of commented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's useful context considering this was the approach in the linked StackOverflow post

// sqlx::query::<Postgres>("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE")
// .execute(&mut *txn)
// .await?;
let result = sqlx::query_as::<Postgres, ()>(query)
.bind(account.as_ref())
.bind(project)
Expand Down
Loading