use render proc to write out results, see if that makes things faster
This commit is contained in:
parent
1845b54f66
commit
9d6ae5baae
1 changed files with 14 additions and 11 deletions
|
@ -33,6 +33,8 @@ class AmfController < ApplicationController
|
||||||
bytes=getlong(req) # | get total size in bytes
|
bytes=getlong(req) # | get total size in bytes
|
||||||
args=getvalue(req) # | get response (probably an array)
|
args=getvalue(req) # | get response (probably an array)
|
||||||
|
|
||||||
|
RAILS_DEFAULT_LOGGER.info(" Message: #{message}")
|
||||||
|
|
||||||
case message
|
case message
|
||||||
when 'getpresets'; results[index]=putdata(index,getpresets)
|
when 'getpresets'; results[index]=putdata(index,getpresets)
|
||||||
when 'whichways'; results[index]=putdata(index,whichways(args))
|
when 'whichways'; results[index]=putdata(index,whichways(args))
|
||||||
|
@ -48,13 +50,14 @@ class AmfController < ApplicationController
|
||||||
RAILS_DEFAULT_LOGGER.info(" Response: start")
|
RAILS_DEFAULT_LOGGER.info(" Response: start")
|
||||||
response.headers["Content-Type"]="application/x-amf"
|
response.headers["Content-Type"]="application/x-amf"
|
||||||
a,b=results.length.divmod(256)
|
a,b=results.length.divmod(256)
|
||||||
ans=0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
|
render :text => proc { |response, output|
|
||||||
|
output.write 0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
|
||||||
results.each do |k,v|
|
results.each do |k,v|
|
||||||
RAILS_DEFAULT_LOGGER.info(" Response: encode #{k}")
|
RAILS_DEFAULT_LOGGER.info(" Response: encode #{k}")
|
||||||
ans+=v
|
output.write(v)
|
||||||
end
|
end
|
||||||
|
}
|
||||||
RAILS_DEFAULT_LOGGER.info(" Response: end")
|
RAILS_DEFAULT_LOGGER.info(" Response: end")
|
||||||
render :text => ans
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue