Closed timriley closed 6 years ago
@GustavoCaso @flash-gordon @solnic Do you have any thoughts on how we deal with these broadcast event args? I'm inclined to opt for the 3rd option:
broadcast :step_succeeded, step: step_name, result: value, input: args.first, args: args[1..-1]
I'll try make this change Wednesday or Thursday this week (and then push out a release) unless you have any other thoughts.
@timriley thank you for this.
Yes, I agree on sending a hash would be easier for the user to extract all the information they need.
Regarding the different options, I'm with you on using the 3rd option.
broadcast :step_succeeded, step: step_name, result: value, input: args.first, args: args[1..-1]
@timriley right, passing a hash is better 👍
Looks like @GustavoCaso has fully covered this in #90, so I'll close this.
This PR makes 2 changes:
step_succeeded
events. This was (inadvertently?) removed in #83, with this change to rename the broadcast event from#{step_name}_succeeded
tostep_succeeded
.step_succeeded
andstep_failed
events, and moves the output/failure value to be the second argument in the broadcast event, right after step name, with the input args last, since they are variadic/splatted, which would potentially make finding the output value harder to do.With this change made, subscribers should now have all the information they need, but I wonder if we can make it even clearer by publishing a hash of data instead of these positional args. So instead of this:
We do this:
Or possibly even this (if we want to separate the single input value from the rest of the step args, which'd be a nice distinction to make, I think):
I'm going to hold up the next release until we can clear this up, since I don't want to have to change the API for the broadcast events twice in quick succession.