-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Prevent duplicate actions email #35215
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
base: main
Are you sure you want to change the base?
Conversation
So I was trying to answer @inxcts question before I came across such issue. After applying the patch, I no longer see duplicate email (that's with unfinished job status while run is concluded as done). However, redoing the steps to reproduce and I still observe one duplicate attempt to send email in trace log, which means there are twice that can pass the applied check right after manually cancelling run. I notice MailActionsTrigger is triggered multiple times. |
The event source is scattered. The "show call hierarchy" golang ide feature, of the event function should show every possible source of the event. Maybe we should restructure this to trigger only completed events from the caller that is able to atomically update the database struct to success/failure/etc...
How many did you test? My unit tests have small number of jobs and could be the cause of being undetected. Sounds like I need to audit the event source with bigger workflows, workflow_run action triggger and webhook would also trigger twice if this is true. I thought about adding temporary traces that dumps strack traces then look at the stack traces of the doubled event |
@ChristopherHX Previously I had only tested the feature with like 1, 2 or 3 dummy jobs. 🤦♂️
Here's what I'm currently using to triage. |
@ChristopherHX In |
Thanks for taking a look :)
Could be very likely a bug that found it's way into my PR during changes by reviewers, I might missed writing a test for cancel/approve flows so this was not detected in CI The cases where WorkflowJobStatus update follows sounds more correct |
@ChristopherHX I applied cdb1e80 yet still see the same one duplicate attempt. I could not figure out cause at this moment so feel free to propose changes or directly push to the branch. |
Yes I can take a look at this as well. Notice: approve workflow run notice was expected to be triggered before running the jobs, for cancelling the order cancel jobs then notify workflow run |
This reverts commit cdb1e80.
Trying to prevent duplicate action emails by adding an extra check on job status.
Producing the issue: