Greetings,
I’ve got a rails app which is basically an admin interface to a xml
dataset. Currently I’ve got rails rigged to call a function to spit the
entire dataset to file with every change. This would actually be ok,
its
fairly infrequently updated, but when the dataset grows large the user
sits
there waiting for it to dump with no feedback as to whats going on. Oh
yes,
nearly forgot; I’m on Lighttpd with FastCGI.
I was thinking maybe just maybe I could dump to file after doing the
render() or redirect_to() calls and perhaps the client would get their
response before the method call terminated, that perhaps the render() /
redirect_to() was actually ther response being sent. I’m pretty sure
the
this is wrong, that the method call termiantion signals the response to
client, but I got a very odd error when I tried it;
ActionController::DoubleRenderError (Can only render or redirect once
per
action):
/vendor/rails/actionpack/lib/action_controller/base.rb:591:in
render_with_no_layout' /vendor/rails/actionpack/lib/action_controller/layout.rb:228:in
render_without_benchmark’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:53:in
render' /usr/lib/ruby/1.8/benchmark.rb:293:in
measure’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:53:in
render' /vendor/rails/actionpack/lib/action_controller/base.rb:636:in
render_to_string’
I use render_to_string(:partial => ‘datapoint’) to render the individual
datapoints; whats odd is that render_to_string isnt working after
redirect_to and render(). If I move the data-dump before these, it
works
fine and no errors appear. But whatever, although the error is just
plain
wrong and should not happen(there’s no reason rener_to_string should
stop
working after redirect_to or render), I’m pretty sure it wouldnt fix
anything even if it was working.
Anyways, I gotta do something. I’ve really got two key important
factors;
#1 the user needs to not have to wait while data gets dumped, they
should
get their response instantaneously
#2 the data dump must occur ASAP. Even a 1 minute delay is not
acceptable,
so no Cron.
Thanks!
Rektide “CronHater”