ruby - Run code after after the page is rendered to the user (Sinatra) -
i'm looking way run slow code after after page rendered user. concretely, i'd able this:
get '/fast-action' compute_after_render { set slow code here } 'request successful' end
i thought inserting info computation database. , running rufus scheduler checking if there compute 1 time minute. wouldn't want user wait database finish insertion. is there way create sinatra run code after after page rendered user?
yes, 1 quick , easy way start new thread:
get '/fast-action' body 'request successful' thread.new{ slow code } end
ruby sinatra high-load
No comments:
Post a Comment