I am using 3 callbacks after a post is created.
1) Post created
callback#1) after_commit :do_notify, :on => :create for creating Notification
2) Notification created
callback#2) after_commit :publish_to_all, :on => :create for sending out messages/ to user using private_pub
It is taking more than a minute to complete the whole flow.
Question#1: Is the approach wrong?
Question#2: Is there a method to send rest of callbacks to background
and complete it there?
there are also observers: http://api.rubyonrails.org/classes/ActiveRecord/Observer.html
and for the async task you could use: https://www.ruby-toolbox.com/categories/Background_Jobs