Rails background task on post request, returns json on completion -
i'm sure has solved problem before, i'm keen learn experiences.
architecture: server web server server b api server server c datasource
user fills out form on server server submits post request server b server b grabs data server c, creates image, uploads image server a, returns resulting url response server a.
the workflow on server b quite critical, needs responsive @ times, needs service many requests. there thousands of active users on server a.
my question this: how active end result without locking rails app on server b?
i've done proof of concept data fetch , image creation in action controller on server b. i'm not perform , give user experience.
with regard uploading image server a, i'm able use sftp considering mounting server a's target folder locally on server b.. reduce unnecessary logons.
thanks in advance wisdom.
you can delayed_job. , there many gems available resque , on. using delayed_job
can follows:
def get_reponse_from_server2 #create method in model stuff #do stuff end handle_asynchronously :get_reponse_from_server2
Comments
Post a Comment