Skip to content

Commit bb017fc

Browse files
committed
fix
1 parent 2b74b2e commit bb017fc

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.3.15-hotfix1
2+
3+
* Fix Bill Caching issue between multiple identities
4+
15
# 0.3.15
26

37
* Upload and download files to and from Nostr using Blossom

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "0.3.15"
2+
version = "0.3.15-hotfix1"
33
edition = "2024"
44
license = "MIT"
55

crates/bcr-ebill-persistence/src/db/bill.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,8 @@ impl BillStoreApi for SurrealBillStore {
8686
identity_node_id: &str,
8787
bill: &BitcreditBillResult,
8888
) -> Result<()> {
89-
// first, delete existing cache entry
90-
let mut bindings = Bindings::default();
91-
bindings.add(DB_TABLE, Self::CACHE_TABLE)?;
92-
bindings.add(DB_BILL_ID, id.to_owned())?;
93-
bindings.add(DB_IDENTITY_NODE_ID, identity_node_id.to_owned())?;
94-
self.db
95-
.query_check(
96-
"DELETE FROM type::table($table) WHERE bill_id = $bill_id AND identity_node_id = $identity_node_id",
97-
bindings,
98-
)
99-
.await?;
89+
// first, delete existing cache entries for bill
90+
self.invalidate_bill_in_cache(id).await?;
10091

10192
// then, put in the new one
10293
let entity: BitcreditBillResultDb = (bill, identity_node_id).into();
@@ -1546,24 +1537,19 @@ pub mod tests {
15461537
.expect("could not save bill to cache");
15471538

15481539
// get bill from cache
1549-
let cached_bill = store
1550-
.get_bill_from_cache("1234", "1234")
1551-
.await
1552-
.expect("could not fetch from cache");
1553-
assert_eq!(cached_bill.as_ref().unwrap().id, "1234".to_string());
1554-
// get bill from cache for other identity
15551540
let cached_bill = store
15561541
.get_bill_from_cache("1234", "4321")
15571542
.await
15581543
.expect("could not fetch from cache");
15591544
assert_eq!(cached_bill.as_ref().unwrap().id, "1234".to_string());
15601545

1546+
// removed for other identity now
15611547
// get bills from cache
15621548
let cached_bills = store
15631549
.get_bills_from_cache(&["1234".to_string(), "4321".to_string()], "1234")
15641550
.await
15651551
.expect("could not fetch from cache");
1566-
assert_eq!(cached_bills.len(), 2);
1552+
assert_eq!(cached_bills.len(), 1);
15671553

15681554
// get bills from cache for other identity
15691555
let cached_bills = store

0 commit comments

Comments
 (0)