Sidekiq Retries Causing Duplicate Wiki Comment Mentions

Summary

There's a bug with wiki comments where the "mentioned in..." system note fails during Sidekiq job processing, causing the job to be retried multiple times and resulting in duplicate event insertions.

Current Behavior

The job fails in the "creating the 'mentioned in...' system note part" which triggers Sidekiq to retry the job. Each retry results in a duplicate event insertion.

Expected Behavior

The job should complete successfully on the first attempt, creating only a single event for the wiki mention.

Proposed Fix

The fix appears to involve modifying the to_reference method in app/models/wiki_page/meta.rb:

diff

diff --git a/app/models/wiki_page/meta.rb b/app/models/wiki_page/meta.rb
index b96c0bc561da..ce8d76fa5575 100644
--- a/app/models/wiki_page/meta.rb
+++ b/app/models/wiki_page/meta.rb
@@ -160,7 +160,7 @@ def update_state(created, known_slugs, wiki_page, updates)
self.canonical_slug = wiki_page.slug
end

- def to_reference
+ def to_reference(*)
canonical_slug
end

Edited by Matthew Macfarlane