forked from alemi/upub
fix: side effects only after inserting
otherwise duplicate fetches will increment counter before being caught as duplicates
This commit is contained in:
parent
2442872b5f
commit
35796c6e93
1 changed files with 2 additions and 2 deletions
|
@ -42,6 +42,8 @@ impl Normalizer for super::Context {
|
|||
(_, Some(_)) => {}, // leave it as set by user
|
||||
}
|
||||
|
||||
model::object::Entity::insert(object_model.clone().into_active_model()).exec(self.db()).await?;
|
||||
|
||||
// update replies counter
|
||||
if let Some(ref in_reply_to) = object_model.in_reply_to {
|
||||
if self.fetch_object(in_reply_to).await.is_ok() {
|
||||
|
@ -61,8 +63,6 @@ impl Normalizer for super::Context {
|
|||
.await?;
|
||||
}
|
||||
|
||||
model::object::Entity::insert(object_model.clone().into_active_model()).exec(self.db()).await?;
|
||||
|
||||
for attachment in object_node.attachment().flat() {
|
||||
let attachment_model = match attachment {
|
||||
Node::Empty => continue,
|
||||
|
|
Loading…
Reference in a new issue