# 웹훅 topic\_posts\_count 값 불일치

**URL:** <https://meta.discourse.org/t/discrepancies-in-webhook-topic-posts-count/292741>\
**Category:** Bug\
**Created:** [1월 24, 2024, 9:02오전 UTC](https://meta.discourse.org/t/discrepancies-in-webhook-topic-posts-count/292741 "2024-01-24T09:02:22Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [1월 24, 2024, 9:02오전 UTC](https://meta.discourse.org/t/discrepancies-in-webhook-topic-posts-count/292741/1 "2024-01-24T09:02:22Z")

</div>

저희는 Discourse 웹훅의 `Post Event`(새로운 답글, 편집, 삭제 또는 복구 발생 시)를 사용하고 있습니다. 주제(토론) 내에서 게시글(댓글)이 작성되면 웹훅이 전송되고, 이 정보를 활용하여 WP(WordPress) 측의 데이터를 업데이트합니다.

주제 내의 일부 게시글이 _삭제_된 후, `topic_filtered_posts_count` 또는 `topic_posts_count` 값이 정확하지 않다는 것을 발견했습니다. 댓글이 _추가_되거나 _편집_되는 동안에는 카운트가 올바르게 생성되지만, 댓글이 하나 이상 삭제되는 순간부터 이 카운트 값들이 작은 수치(때로는 1, 때로는 2 등)만큼 불안정하게 어긋나기 시작합니다.

문제가 WP 측인지 Discourse 측인지 확인하기 위해 웹훅 페이로드를 검사해 본 결과, 웹훅이 잘못된 정보를 전송하고 있는 것으로 드러났습니다. 모든 게시글의 아카이브가 `:regular`이고 현재 삭제된 게시글이 없는 상황에서도 `topic_posts_count`와 `topic_filtered_posts_count` 사이에 불일치가 발생하는 경우가甚至有 있습니다.

이로 인해 웹훅과 (재)삭제 처리 모두 비동기 방식으로 처리되는 것이 문제의 원인이라고 추측하고 있지만, 이것이 실제로 그런지 확신은 없습니다.

---

_[View the full topic](https://meta.discourse.org/t/discrepancies-in-webhook-topic-posts-count/292741)._
