Webhook の競合状態緩和戦略

Hey everyone! :waving_hand:

I’m working on building a two-way sync between Discourse and Discord. On the Discourse side, I’m using webhooks for topic and post events (created, edited, destroyed, recovered) to relay updates to the corresponding Discord channels. The other direction is handled using a bot built with discord.js.

I’ve been running into some issues getting my middleware to handle things cleanly — mainly due to a race condition between when topic and post webhooks are received.

I’d love some advice on how to best handle this. Right now, I’m considering dropping topic webhooks entirely and basing everything around post events (using topic_id as the unifier). That said, I’d prefer to find a way to make my current setup work rather than rewriting everything from scratch.

Any insights or suggestions would be greatly appreciated! :folded_hands:

「いいね!」 1

I just decided to fetch the values and fill in some data before having the topic in my database