Closed juhlig closed 2 years ago
@seriyps You reviewed this before, is it ready for merge?
@mworrell I think @juhlig only pushed some extra tests for "failure scenarios" after I approved. So, LGTM.
@mworrell Also, still would appreciate if we'd manage to cut a new release. I can prepare all the changelogs etc if you don't have time.
I am not sure I have access to the hex repo, or was the hex push automated?
@mworrell nope, it is not automated. I see only 3 users have admin permissions on hex:
sleepy_keita
arjan
vagabond
The current implementation of
gen_smtp_client:send/3
with a callback function has some issues:send/3
with no callback, it returns only a pid, not{ok, Pid}
send/3
with no callback, the spawned (middleman) process is not linked to the calling process, so if the calling process dies, the send operation will be aborted when no callback is used, but left running if a callback is usedsend_it
call insend_it_nonblock
, called from the inner process causes that process to exit, the outer process calls the Callback with{exit, Reason}
as argument. However, the same will happen if thesend_it
call succeeds, the result gets passed to the Callback, and then the Callback itself causes an exit of the inner process, so the callback will be called again with{exit, Reason}
in the outer processBy the changes in this PR,
send/3
will always return{ok, Pid}
send_it
call (which are then passed as{exit, Reason}
to the callback if one is given, or cause the process to exit if no callback is given) are separated from exits resulting from the Callback (which always cause the process to exit)