From: Steve Coast Date: Wed, 9 May 2007 17:31:11 +0000 (+0000) Subject: various fixes X-Git-Tag: live~8454 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6ccf25b347d90b2ae7b1f2e2b5c8f042e0790a3b various fixes --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index a864d3dcf..9947a4eaa 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -1,4 +1,5 @@ class AmfController < ApplicationController +=begin require 'stringio' # to log: @@ -610,5 +611,5 @@ class AmfController < ApplicationController 180/Math::PI * (2*Math.atan(Math.exp(a*Math::PI/180))-Math::PI/2) end - +=end end diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 8261e56aa..3c739e37f 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -18,6 +18,7 @@ class ApiController < ApplicationController def map @@count+=1 + response.headers["Content-Type"] = 'text/xml' # Figure out the bbox bbox = params['bbox'] @@ -103,14 +104,14 @@ class ApiController < ApplicationController doc.root << way.to_xml_node() end + render :text => doc.to_s + #exit when we have too many requests if @@count > MAX_COUNT render :text => doc.to_s @@count = COUNT - exit + exit! end - render :text => doc.to_s - end end diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index ac4a4056e..b4e9d7f51 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -107,7 +107,7 @@ class TraceController < ApplicationController @trace.timestamp = Time.now if @trace.save - saved_filename = "/tmp/#{@trace.id}.gpx" + saved_filename = "/home/osm/gpx/#{@trace.id}.gpx" File.rename(filename, saved_filename) logger.info("id is #{@trace.id}") diff --git a/app/models/node.rb b/app/models/node.rb index 6f01ccee0..6eecc853d 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -85,7 +85,7 @@ class Node < ActiveRecord::Base el1['lon'] = self.longitude.to_s # el['user'] = self.user.display_name if self.user.data_public? - + user_display_name_cache = {} if user_display_name_cache.nil? if user_display_name_cache and user_display_name_cache[self.user_id] # use the cache if available else diff --git a/app/models/segment.rb b/app/models/segment.rb index b6f60ec3f..14949879d 100644 --- a/app/models/segment.rb +++ b/app/models/segment.rb @@ -78,6 +78,8 @@ class Segment < ActiveRecord::Base el1['id'] = self.id.to_s el1['from'] = self.node_a.to_s el1['to'] = self.node_b.to_s + + user_display_name_cache = {} if user_display_name_cache.nil? if user_display_name_cache and user_display_name_cache[self.user_id] # use the cache if available else diff --git a/app/models/way.rb b/app/models/way.rb index cd06b1210..65bb3158d 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -56,6 +56,8 @@ class Way < ActiveRecord::Base el1['visible'] = self.visible.to_s el1['timestamp'] = self.timestamp.xmlschema + user_display_name_cache = {} if user_display_name_cache.nil? + if user_display_name_cache and user_display_name_cache[self.user_id] # use the cache if available else diff --git a/config/environment.rb b/config/environment.rb index e7a6c91ef..35bb86bf0 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -77,4 +77,4 @@ HTTP_EXPECTATION_FAILED = 417 #Taming FCGI # COUNT = 0 -MAX_COUNT = 500 +MAX_COUNT = 10