Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
fix(proxy): session not loaded on restart (#907)
Browse files Browse the repository at this point in the history
A regression was introduced in our upstream dependency `kv` which breaks
the loading of our session from disk. Until we land a patch, this is the
stopgap solution.

Stop-gap for #900
  • Loading branch information
xla committed Sep 15, 2020
1 parent 0c2c563 commit 6c3832d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
9 changes: 4 additions & 5 deletions proxy/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion proxy/api/Cargo.toml
Expand Up @@ -15,7 +15,6 @@ default-run = "api"
anyhow = "1.0"
directories = "2.0"
futures = { version = "0.3", features = [ "compat" ] }
kv = { version = "0.22", features = [ "json-value" ] }
log = "0.4"
percent-encoding = "2.1"
pico-args = "0.3"
Expand All @@ -28,6 +27,11 @@ thiserror = "1.0"
tokio = { version = "0.2", features = [ "dns", "macros", "time" ] }
warp = { version = "0.2", default-features = false }

[dependencies.kv]
git = "https://github.com/zshipko/rust-kv.git"
rev = "a98e1ace84b22ceaac276abf796633bd8e735500"
features = [ "json-value" ]

[dependencies.coco]
path = "../coco"

Expand Down
2 changes: 1 addition & 1 deletion proxy/api/src/session.rs
Expand Up @@ -91,7 +91,7 @@ fn get(store: &kv::Store, key: &str) -> Result<Session, error::Error> {
Ok(store
.bucket::<&str, kv::Json<Session>>(Some(BUCKET_NAME))?
.get(key)?
.map(kv::Codec::into_inner)
.map(kv::Codec::to_inner)
.unwrap_or_default())
}

Expand Down
6 changes: 5 additions & 1 deletion proxy/coco/Cargo.toml
Expand Up @@ -12,7 +12,6 @@ repository = "git@github.com:radicle-dev/radicle-upstream.git"

[dependencies]
futures = { version = "0.3", features = [ "compat" ] }
kv = { version = "0.22", features = [ "json-value" ] }
lazy_static = "1.4"
log = "0.4"
nonempty = "0.5"
Expand All @@ -21,6 +20,11 @@ syntect = "4.2"
thiserror = "1.0"
tokio = { version = "0.2", features = [ "dns", "macros", "time" ] }

[dependencies.kv]
git = "https://github.com/zshipko/rust-kv.git"
rev = "a98e1ace84b22ceaac276abf796633bd8e735500"
features = [ "json-value" ]

[dependencies.librad]
git = "https://github.com/radicle-dev/radicle-link.git"
rev = "c16ce900776975e3de017af71763dc4e2e129d3f"
Expand Down
2 changes: 1 addition & 1 deletion proxy/coco/src/peer/announcement.rs
Expand Up @@ -111,7 +111,7 @@ pub fn load(store: &kv::Store) -> Result<Updates, Error> {
let bucket = store.bucket::<&'static str, kv::Json<Updates>>(Some(BUCKET_NAME))?;
let value = bucket
.get(KEY_NAME)?
.map_or(HashSet::new(), kv::Json::into_inner);
.map_or(HashSet::new(), kv::Json::to_inner);

Ok(value)
}
Expand Down

0 comments on commit 6c3832d

Please sign in to comment.