Skip to content

Commit

Permalink
Setting up rollover rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Jun 12, 2010
1 parent 103f0af commit 3324cd2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ require 'tasks/rails'
desc "Run all tests and features" desc "Run all tests and features"
task :default => [:test, :cucumber] task :default => [:test, :cucumber]


task :cron => ['gemcutter:store_legacy_index'] desc "Run daily at 00:00 UTC"
task :cron => %w[gemcutter:downloads:rollover gemcutter:store_legacy_index]
1 change: 0 additions & 1 deletion app/models/download.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def self.rollover
hash hash
end end


#{"rails-2.3.5" => 9299, "rack-1.1" => 2323",
downloads = Hash[*$redis.zrange(YESTERDAY_KEY, 0, -1, :with_scores => true)] downloads = Hash[*$redis.zrange(YESTERDAY_KEY, 0, -1, :with_scores => true)]
downloads.each do |key, score| downloads.each do |key, score|
version = versions[key] version = versions[key]
Expand Down
5 changes: 5 additions & 0 deletions lib/tasks/downloads.rake
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace "gemcutter:downloads" do namespace "gemcutter:downloads" do
desc "Daily rollover and aggregation"
task :rollover => :environment do
Download.rollover
end

desc "Migrate from downloads table to redis" desc "Migrate from downloads table to redis"
task :migrate => :environment do task :migrate => :environment do
# create index "index_downloads_on_created_at_and_date" on downloads (version_id, date(created_at)); # create index "index_downloads_on_created_at_and_date" on downloads (version_id, date(created_at));
Expand Down

0 comments on commit 3324cd2

Please sign in to comment.