Permalink
Browse files

Compare to cache to previously passed modified, not server time

  • Loading branch information...
1 parent cdf812f commit ad4b3ebea0451bc2a6957c73c46afbae26823af1 @jpallen jpallen committed May 20, 2012
Showing with 3 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +2 −2 app/models/url_cache.rb
View
@@ -1,3 +1,4 @@
+**.swp
latexchroot
db/*.sqlite3
log
@@ -15,9 +15,10 @@ def load_from_url(url, modified_date)
elsif (not modified_date.nil? and cache.fetched_at < modified_date)
cache.download!
end
+ cache.fetched_at = modified_date
cache.last_accessed = Time.now
cache.save
-
+
return cache
end
@@ -39,7 +40,6 @@ def path_to_file_on_disk
def download!
FileUtils.mkdir_p(File.dirname(self.path_to_file_on_disk))
UrlCache.download_url(self.url, self.path_to_file_on_disk)
- self.fetched_at = Time.now
end
def remove_cache_file

0 comments on commit ad4b3eb

Please sign in to comment.