DEV Community

Discussion on: How to implement Pub/Sub pattern in Ruby on Rails?

Collapse
 
vladhilko profile image
Vlad Hilko

My approach would be to delegate the email sending task to a separate job or use something like this:

AnimalMailer.with(user: event[:user]).welcome_email.deliver_later
Enter fullscreen mode Exit fullscreen mode

That way, the service can continue working without waiting for the send to complete.

Collapse
 
mrnagoo profile image
Anag

cool, thanks. Good write up!