Permalink
Browse files

reset to earlier state

  • Loading branch information...
1 parent 39a1c07 commit 6296096c56901dae85e3ded42a8afe778b70ce00 @adevadeh adevadeh committed Jun 19, 2012
Showing with 2 additions and 8 deletions.
  1. +2 −8 rubygems_proxy.rb
View
@@ -12,7 +12,6 @@ def self.call(env)
def initialize(env)
@env = env
- @spec_cached = {}
logger.level = Logger::INFO
end
@@ -85,13 +84,12 @@ def contents
if File.directory?(filepath)
logger.info "Is a dir, returning 404: #{filepath}"
erb(404)
- elsif cached? && (!specs? || spec_cached?)
+ elsif cached? && !specs?
logger.info "Read from cache: #{filepath}"
open(filepath).read
else
logger.info "Read from interwebz: #{url} <--- #{ specs? || gem_file? ? "is" : "NOT"} a gem or spec"
# pass the Host header to correctly access the rubygems site
- @spec_cached[env["PATH_INFO"]] = Time.now
open(url).read.tap { |content| save(content) if gem_file? }
end
end
@@ -102,11 +100,7 @@ def save(contents)
end
def specs?
- env["PATH_INFO"] =~ /specs\..+\(.gz|.rz)$/
- end
-
- def spec_cached?
- Time.now - @spec_cached[env["PATH_INFO"]] < 100 * 60
+ env["PATH_INFO"] =~ /specs\..+\.gz$/
end
def gem_file?

0 comments on commit 6296096

Please sign in to comment.