我尝试使用sinatra应用程序,但发生的错误非常神秘。
#encoding: utf-8
require 'sinatra'
require 'rss'
require 'dalli'
require './url'
require './feed'
set :bind, '0.0.0.0'
configure :production do
require 'newrelic_rpm'
end
...
configure :development do
require 'sinatra/reloader'
end
...
get '/new_movie' do
if params['tag2']
@key = 'tag1=' + params['tag1'] + '&tag2=' + params['tag2']
else
@key = 'tag1=' + params['tag1']
end
configure :production do ####### ERROR OCCURS AT HERE! #######
# if cache exists
if output = settings.cache.get(@key)
@isCacheUsed = true
output
end
end
unless @isCacheUsed
# Thread One
t1 = Thread.new(params['tag1']) do |param_tag1|
@feed_nico = feed_nico(param_tag1)
puts 'nico' if DEBUG_APP
end
# Thread Two
if params['tag2']
t2 = Thread.new(params['tag2']) do |param_tag2|
@feed_vimeo = feed_vimeo(param_tag2)
puts 'vimeo' if DEBUG_APP
end
end
# Main Thread
feed_hatena1 = feed_hatena(params['tag1'])
puts 'hatena1' if DEBUG_APP
t1.join
t2.join if params['tag2']
if params['tag2']
feed = feed_hatena1.append(
@feed_nico, @feed_vimeo).
unique
puts 'append + unique' if DEBUG_APP
else
feed = feed_hatena1.append(@feed_nico).unique
end
content_type = 'text/xml; charset=utf-8'
@output = feed.to_s
end
end
...
感谢您的帮助。
答案 0 :(得分:1)
您无法在路线中拨打“配置”。确保所有配置参数都存在于路径之外