Conversation
I think this behavior makes sense as is. We never expect handling to get this far if the process has already ended. Therefore, the only purpose of All that said, I think we might have a race condition here when it comes to handling events. This line here verity/handler/process/adaptor.go Line 83 in 32970c0
I think this relates to the last paragraph, but I'm not sure which panic you're referring to. |
handler/process/adaptor.go
Outdated
| packer: a.Packer, | ||
| logger: a.Logger, | ||
| instanceID: inst.InstanceID, | ||
| ended: inst.HasEnded, |
There was a problem hiding this comment.
This may not be necessary, as you pointed out, adding it doesn't change any behavior. If we do need more test cases, it would be to guarantee that both events and timeouts are ignored for ended processes (these may already exist?)
There was a problem hiding this comment.
Should I remove this ended initialisation?
The panic I ment was the one in the handler that is given the created scope. I guess i'm more referring to what happens on the next time the process gets sent an event after having ended from handling a previous event/timeout. Perhaps Dogma already knows not call it again? |
No, something here needs to check the ended flag before routing the message (it's already doing it for timeouts). |
|
I've added a check for ended process before handling new messages. Not quite sure if that covers what you mentioned though? |
handler/process/adaptor.go
Outdated
| return nil | ||
| } | ||
|
|
||
| if exists && inst.HasEnded { |
There was a problem hiding this comment.
| if exists && inst.HasEnded { | |
| if inst.HasEnded { |
Pretty sure this can be simplified and the if above this one can then be removed.
There was a problem hiding this comment.
Also, I don't think there's any existing test for this logic, and certainly not for events specifically.
There was a problem hiding this comment.
Can't remove the if block above without breaking a timeout test for a not yet existing instance.
There was a problem hiding this comment.
I've removed the exists check from that line and added another test to verify messages to an already ended process get ignored.
What change does this introduce?
Ending a process is now permanent.
Why make this change?
This change is to match the new ADR-24 spec.
Is there anything you are unsure about?
adaptor.goshould be checking the instanceHasEndedflag before creating the scope and panic from there rather than doing it inHandleMessage()?ended: inst.HasEnded,to the processscopecreation still passes tests. Another test case might be needed?What issues does this relate to?
Fixes #660