Hello, can You please explain to me why we can't use Thread.new in
Let's suppose the following situation: we have a blog and using remote
search engine (in form of http service) to index it. So, after any
change to the blog post we should also make an http call to notify
search service about changes. In the code it will look something like
class Post < ActiveRecord::Base
after_save do |model|
# making remote HTTP call.
class PostController < ActiveController::Base
post = Post.by_id(params[:id])
render json: post
Theoretically it should work. It should update post, immediately return
and finish call to the search engine sometime later
But nobody does this, why?
For a very long time, I thought that nobody using this technique because
this external http call will blocks the whole VM, so it make no sense to
But a couple days ago I found that this is actually wrong, this http
call will not block the VM (Fibur as a prove
So, now I wondering - what other problems are out there? Why nobody uses
this and use instead tools like delayed_job and resque?