Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot double-commenting #277

Closed
nedbat opened this issue Nov 13, 2023 · 2 comments
Closed

Bot double-commenting #277

nedbat opened this issue Nov 13, 2023 · 2 comments

Comments

@nedbat
Copy link
Contributor

nedbat commented Nov 13, 2023

(From #273)

BTW, it comments twice because the "Close with comment" button causes two events to fire (comment created and pull request closed). They are both sent to the webhook at the same time, so two requests are handled, and each sees the pull request with no comment on it, so both add a comment.

The comment should be ignored if the bot created it, and I thought the bot already did ignore those?

@nedbat
Copy link
Contributor Author

nedbat commented Nov 13, 2023

I was wrong. The problem happens when you the comment box and click "Close pull request". This causes two events, both by a real person: comment created and pull request closed. The bot handles them in parallel, causing two comments.

nedbat pushed a commit that referenced this issue Nov 14, 2023
This check (that the comment create date and the pull request closed
date are the same) might not be 100% fool-proof. If they are off by one
second, the bot will still comment twice, but that should be unlikely.
nedbat pushed a commit that referenced this issue Nov 15, 2023
This check (that the comment create date and the pull request closed
date are the same) might not be 100% fool-proof. If they are off by one
second, the bot will still comment twice, but that should be unlikely.
@nedbat
Copy link
Contributor Author

nedbat commented Nov 15, 2023

Fixed in #278.

@nedbat nedbat closed this as completed Nov 15, 2023
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

No branches or pull requests

1 participant