Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9203985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:35:57+00:00 2026-06-17T23:35:57+00:00

I need to make some slow operations on controller action. But it’s not necessary

  • 0

I need to make some slow operations on controller action. But it’s not necessary to wait this operation for response rendering.

class ProductController < ActionController
  def update
    slow_operations()
    render json: {status: 'ok'}
  end
end

Even I move my code after render in Product#update action, it’s not reduces response time.

class ProductController < ActionController
  def update
    render json: {status: 'ok'}
    slow_operations()
  end
end

How to force to return complete response before executing of slow operations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:35:58+00:00Added an answer on June 17, 2026 at 11:35 pm

    Because of the way Rails works, it’s still going to do the actual “rendering” after the action is complete – so, as you found out, moving “render” higher in your action doesn’t help. What you need to do is shuffle off the long-running operation into a background process. There’s lots of gems to do this, including BackgroundRb, Delayed Job and Sidekiq (my personal favourite, largely because it is multi-threaded, cutting down on the number of processes you need to start, and because of its nice web-based admin/monitoring interface).

    There’s even a Railscast to get you started for most of these, like this one: http://railscasts.com/episodes/366-sidekiq

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need make some action (dump statistical data) before the Dart program ends. The
I need some info on this subject. I've searched around a bit but it
I need to make requests to an api via soap but this api can
I need to make some changes to an old Oracle stored procedure on an
I need to make some recurrent modification in a lot of files (C++). I
I need to make some part of text bold while displaying in jquery: $(':checked').each(function()
I have some data which i need to make some statistics. I need to
I am C++ programmer and I need to make some changes to VB6 code.
I have an excel file that I need to make some changes. I need
I need to make use of some OWL ontologies in c#. Does anyone have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.