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

Fixed race condition when calling onCompleteCallback. #26

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

danilo04
Copy link
Contributor

@danilo04 danilo04 commented Jul 26, 2020

Fixed race condition when calling onCompleteCallback. The execution of the callback should not be tied to a timeout, should be executed after the email was sent or an error is catched. It is mentioned in javier-moreno's message in Design of Library issue.

The fix changes the behavior of onCompleteCallback to just set the field successCallback. In the block that sends the email, a finally block is added to call the method callOnCompleteCallback. This method does the same as the previous implementation of onCompleteCallback but gets the Handler of the UI Thread. By executing the callbacks on the UI thread, we avoid any errors if the callbacks (onSuccess or onFail) update UI elements.

…f the callback should not be tied to a timeout, should be executed after the email was sent or an error is catch.
@nedimf nedimf merged commit 3286854 into nedimf:master Aug 3, 2020
@nedimf
Copy link
Owner

nedimf commented Aug 3, 2020

Thank you

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

Successfully merging this pull request may close these issues.

2 participants