diff --git a/src/db/spanner/models.rs b/src/db/spanner/models.rs index dd6aa6b3aa..fd461dd366 100644 --- a/src/db/spanner/models.rs +++ b/src/db/spanner/models.rs @@ -144,7 +144,9 @@ impl SpannerDb { .get_string_value() .parse::() .map_err(|e| DbErrorKind::Integrity(e.to_string()))?; - self.coll_cache.put(id, name.to_owned())?; + if !self.in_write_transaction() { + self.coll_cache.put(id, name.to_owned())?; + } Ok(id) } @@ -177,7 +179,6 @@ impl SpannerDb { "collectionid" => id.to_string(), }) .execute(&self.conn)?; - self.coll_cache.put(id, name.to_owned())?; Ok(id) } @@ -604,7 +605,9 @@ impl SpannerDb { .map_err(|e| DbErrorKind::Integrity(e.to_string()))?; let name = row[1].get_string_value().to_owned(); names.insert(id, name.clone()); - self.coll_cache.put(id, name)?; + if !self.in_write_transaction() { + self.coll_cache.put(id, name)?; + } } }