Compare commits

2 Commits

Author SHA1 Message Date
cuddle-please
dbb79e60b8 chore(release): 0.2.0
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-25 09:07:34 +00:00
4527ee7829 feat: truly cancel if revision isn't as expected
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2025-09-25 11:07:14 +02:00
3 changed files with 25 additions and 1 deletions

View File

@@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.2.0] - 2025-09-25
### Added
- truly cancel if revision isn't as expected
- reset after failure
- print as well
- add publish
- add features for nats and postgres
- add postgres
- extract backend
- do publish
- allow readme
### Other
- *(release)* v0.1.3 (#3)
chore(release): 0.1.3
- Configure Renovate (#4)
Add renovate.json
## [0.1.3] - 2025-09-24
### Added

View File

@@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.1.3"
version = "0.2.0"
license = "MIT"
[workspace.dependencies]

View File

@@ -87,16 +87,20 @@ impl BackendEdge for PostgresBackend {
FROM noleader_leaders
WHERE
key = $1
AND revision = $2
AND heartbeat >= now() - interval '60 seconds'
LIMIT 1;
",
)
.bind(&key.0)
.bind(self.revision.load(Ordering::Relaxed) as i64)
.fetch_optional(&self.db().await?)
.await
.context("get noleader key")?;
let Some(val) = rec else {
self.revision.store(0, Ordering::Relaxed);
anyhow::bail!("key doesn't exist, we've lost leadership status")
};
@@ -105,6 +109,7 @@ impl BackendEdge for PostgresBackend {
let Ok(id) = uuid::Uuid::parse_str(&val.value) else {
tracing::warn!("value is not a valid uuid: {}", val.value);
self.revision.store(0, Ordering::Relaxed);
return Ok(LeaderValue::Unknown);
};