Compare commits
1 Commits
35d579819c
...
bcc57ac804
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcc57ac804 |
@@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [0.2.0] - 2025-09-25
|
## [0.2.0] - 2025-09-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- reset after failure
|
|
||||||
- print as well
|
- print as well
|
||||||
- add publish
|
- add publish
|
||||||
- add features for nats and postgres
|
- add features for nats and postgres
|
||||||
|
|||||||
@@ -144,22 +144,18 @@ impl BackendEdge for PostgresBackend {
|
|||||||
|
|
||||||
let res = match res {
|
let res = match res {
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(e) => {
|
Err(e) => match &e {
|
||||||
self.revision.store(0, Ordering::Relaxed);
|
sqlx::Error::Database(database_error) => {
|
||||||
|
if database_error.is_unique_violation() {
|
||||||
match &e {
|
anyhow::bail!("update conflict: another leader holds lock")
|
||||||
sqlx::Error::Database(database_error) => {
|
} else {
|
||||||
if database_error.is_unique_violation() {
|
|
||||||
anyhow::bail!("update conflict: another leader holds lock")
|
|
||||||
} else {
|
|
||||||
anyhow::bail!(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
anyhow::bail!(e);
|
anyhow::bail!(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
_ => {
|
||||||
|
anyhow::bail!(e);
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
@@ -174,8 +170,6 @@ impl BackendEdge for PostgresBackend {
|
|||||||
// Only update our local revision if the update succeeded with our expected value
|
// Only update our local revision if the update succeeded with our expected value
|
||||||
self.revision.store(rec.revision as u64, Ordering::Relaxed);
|
self.revision.store(rec.revision as u64, Ordering::Relaxed);
|
||||||
} else {
|
} else {
|
||||||
self.revision.store(0, Ordering::Relaxed);
|
|
||||||
|
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"update conflict: expected value={}, revision={}, got value={}, revision={}",
|
"update conflict: expected value={}, revision={}, got value={}, revision={}",
|
||||||
val.0.to_string(),
|
val.0.to_string(),
|
||||||
@@ -213,8 +207,6 @@ impl BackendEdge for PostgresBackend {
|
|||||||
.await
|
.await
|
||||||
.context("failed to release lock, it will expire naturally")?;
|
.context("failed to release lock, it will expire naturally")?;
|
||||||
|
|
||||||
self.revision.store(0, Ordering::Relaxed);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user