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 8131087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:58:20+00:00 2026-06-06T08:58:20+00:00

I am working on a streaming download (CSV) from Rails 3.2 and am coming

  • 0

I am working on a streaming download (CSV) from Rails 3.2 and am coming up against an issue of the initial page request taking a long time. The following controller code illustrates my issue:

      self.response_body = Enumerator.new do |y|
        10_000_000.times do
          y << "Hello World"
        end
      end 

With the above, the response does seem like its streaming (from a server than can support it… Unicorn, in my case). That said, before it starts streaming it hangs for a much longer time than I’d like. If I change it to the following, it starts much faster:

      self.response_body = Enumerator.new do |y|
        1000.times do
          y << "Hello World"
        end
      end

My understanding is that the response should begin with the first iteration of the loop, but it seems the larger loops are causing that initial load time to lengthen. If each iteration is output as it happens, shouldn’t it take the same amount of time to kick off the streaming process, regardless of how many total iterations there will be???

Thanks for any insight you may have!

EDIT:

Here is an explanation of the technique I am attempting. Maybe I am misinterpreting or missing a step?:
http://facebook.stackoverflow.com/questions/3507594/ruby-on-rails-3-streaming-data-through-rails-to-client/4320399#4320399

EDIT:

I think Rack-Cache might be causing my problem… can I turn it off for an individual request?

EDIT and SOLVED:

I was wrong about Rack-Cache. i just needed to add self.response.headers['Last-Modified'] = Time.now.ctime.to_s to my response.

  • 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-06T08:58:21+00:00Added an answer on June 6, 2026 at 8:58 am

    The edited question turned out to contain exactly the answer I needed. Posting it here as an answer.

    The answer to getting the Rack handler to stream properly is apparently to add a Last-Modified header to the response:

    self.response.headers['Last-Modified'] = Time.now.ctime.to_s
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am desperate to get a streaming CSV download working in my Rails 3.2.2
I am working on streaming a song from the web. I have made the
I'm streaming data from a CSV file and trying to import it to SQL
I've been working on some streaming software that takes live feeds from various kinds
I'm working on an application that handles streaming notifications from Exchange Web Services and
I'm working on a life-streaming type app in Rails and am constantly parsing several
I'm working on a project that needs to implement live video streaming from webcam
I am working on streaming a video from web. Where I decode the video/audio
I have been attempting to get streaming working in Rails 3.2 on Heroku (see
I have smooth streaming working on my local machine. The video plays nicely and

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.