Skip to content

Commit

Permalink
Merge pull request #59 from skunkteam/Virtual-branch
Browse files Browse the repository at this point in the history
refactor: Simplified cloning in FirestoreDatabase and Query
  • Loading branch information
pavadeli authored Mar 22, 2024
2 parents 168856a + 4c1bb08 commit 143dff4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/firestore-database/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ impl FirestoreDatabase {
txn.read_doc(name)
.await?
.version_for_consistency(consistency)?
.map(Arc::clone)
.cloned()
} else {
self.get_doc_meta(name)
.await?
.read()
.await?
.version_for_consistency(consistency)?
.map(Arc::clone)
.cloned()
};
Span::current().record("found", version.is_some());
Ok(version)
Expand Down
8 changes: 2 additions & 6 deletions crates/firestore-database/src/database/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,8 @@ impl Query {
for col in collections {
for meta in col.docs().await {
let version = match &txn {
Some(txn) => txn
.read_doc(&meta.name)
.await?
.current_version()
.map(Arc::clone),
None => meta.read().await?.current_version().map(Arc::clone),
Some(txn) => txn.read_doc(&meta.name).await?.current_version().cloned(),
None => meta.read().await?.current_version().cloned(),
};
let Some(version) = version else {
continue;
Expand Down

0 comments on commit 143dff4

Please sign in to comment.