The fact that the lockable module triggers the email before the token is persisted is annoying me in some specs when associated with devise-async.
Also, even tough very unlikely, the current code would allow a worker to have a tiny time frame in which it would be able to render the email before the token is persisted (devise-async loads the record from db).
This change just ensures the token is persisted before triggering the mailer.
Let me know if you need any change.
Persist unlock token before triggering mailer