summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorroot <root@aop.(none)>2012-12-19 17:07:31 +0000
committerroot <root@aop.(none)>2012-12-19 17:07:31 +0000
commit8bf8a6b0494faef24d9c413833d274b152ec0b6e (patch)
tree3d448b00211f269abe331a565bdd8ee06716a4e0 /application.rb
parent19f8eb3261c7e4537173358c6b864fdcc3374db1 (diff)
adjustments for production server
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/application.rb b/application.rb
index 6eac935..b065a58 100644
--- a/application.rb
+++ b/application.rb
@@ -123,7 +123,7 @@ class Application < Sinatra::Base
end
after '/pug/*' do
- CACHE.add request.path, @result, 7200
+ CACHE.add request.path, @result, 72000 if @result
end
before '/cid/:cid/*' do
@@ -136,6 +136,9 @@ class Application < Sinatra::Base
get '/cid/:cid/?' do
@cid = params[:cid]
+ #local("/pug/cid/#{@cid}/predictions")
+ pid = Process.fork{ local("/pug/cid/#{@cid}/predictions") }
+ Process.detach pid
haml :compound
end
@@ -144,8 +147,9 @@ class Application < Sinatra::Base
if !@cids or @cids.empty?
haml :not_found
elsif @cids.size == 1
- @cid = @cids.first
- haml :compound
+ redirect to("/cid/#{@cids.first}")
+ #@cid = @cids.first
+ #haml :compound
else
haml :select
end
@@ -218,7 +222,11 @@ class Application < Sinatra::Base
end
get '/pug/name/:name' do
+ begin
@result = RestClient.get(File.join(PUG_URI,"compound","name",CGI.escape(params[:name]),"cids","TXT")).split("\n").to_json
+ rescue
+ @result = nil
+ end
end
get '/pug/cid/:cid/image' do