Skip to content

[F] Prevent race conditions in comment moderation#10

Merged
hykilpikonna merged 1 commit into
one-among-us:mainfrom
Misaka13514:concurrent-lock
Mar 15, 2026
Merged

[F] Prevent race conditions in comment moderation#10
hykilpikonna merged 1 commit into
one-among-us:mainfrom
Misaka13514:concurrent-lock

Conversation

@Misaka13514

Copy link
Copy Markdown
Member

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent concurrent moderation actions (approve/reject/ban) from being applied to the same pending comment at the same time in the Telegram moderation workflow.

Changes:

  • Added an in-memory per-comment “in process” lock (processingCommentIds) plus a withCommentLock helper to guard moderation actions.
  • Wrapped ban, reject, and pass/pass-spoiler confirm actions with the new locking helper.
  • Added a defensive “already approved” check before creating the commit for pass actions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/kotlin/org/hydev/back/controller/CommentController.kt
Comment thread src/main/kotlin/org/hydev/back/controller/CommentController.kt Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/kotlin/org/hydev/back/controller/CommentController.kt

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/kotlin/org/hydev/back/controller/CommentController.kt
Comment thread src/main/kotlin/org/hydev/back/controller/CommentController.kt
Comment thread src/main/kotlin/org/hydev/back/controller/CommentController.kt
Comment thread src/main/kotlin/org/hydev/back/controller/CommentController.kt
@hykilpikonna hykilpikonna merged commit 344e6e0 into one-among-us:main Mar 15, 2026
1 check passed
@Misaka13514 Misaka13514 deleted the concurrent-lock branch March 16, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants