Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on activitypub.space
technical-discussion·Technical Discussionbyjulian

Detecting duplicate activities

How does one go about detecting duplicate activities, and what is the best practice for senders?

I ask because following a hashtag served by relay.fedi.buzz responds with an Accept with id https://relay.fedi.buzz/activity/accept/%7Bactor%7D/%7BrequesterInbox%7D

Because that URL does not have a random/time-based component, an unfollow followed by a refollow will lead to an Accept with the exact same id.

In NodeBB's case, it detects this as "already seen" and silently drops it.

I could ask @[email protected] to add a timestamp in the ID, but I was wondering if my duplicate detection strategy was naive :smile:

View original on activitypub.space
1

5 replies

mitra.social

@julian @astro There are two related unwritten rules of fediverse:

  1. Activities should be immutable
  2. Activities should be idempotent

Because of (1), the id of activity should be different if the body is different.

But because of (2), it should be ok to process the same activity multiple times.

0
julianreply
activitypub.space

@[email protected] okay, but in the case of the accept, the body is identical, but is only different because of where it sits relative to other activities (e.g. it came after an unfollow therefore it is relevant again)

It makes me think back to why I added dupe detection in the first place. Likely it was to handle Delete spam, but I can't remember anymore.

cc @[email protected]

0

You reached the end

Detecting duplicate activities | Spyke