Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into bundle-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mezis committed Oct 14, 2013
2 parents 6fcbf7f + d215497 commit fa640ee
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions lib/tasks/emails.rake → lib/tasks/appfab_emails.rake
@@ -1,8 +1,8 @@
namespace :appfab do
namespace :emails do
task :send_notifications_digest => :environment do
desc 'sends notification digests to all users'
task :send_notifications_digest => :full_environment do
User.with_state(:visible).find_each do |user|
require 'notification/mailer'
next unless user.notifications.unread.count > 0

notifications = user.notifications.unread.by_most_recent.limit(25)
Expand Down
8 changes: 3 additions & 5 deletions lib/tasks/appfab_ideas.rake
@@ -1,24 +1,22 @@
namespace :appfab do
namespace :ideas do
desc 'updates star ratings for all ideas'
task :update_stars_cache => :environment do
require "account"
task :update_stars_cache => :full_environment do
Account.find_each do |account|
Idea.update_star_cache(account:account)
end
end

desc 'updates counter caches'
task :update_counts => :environment do
task :update_counts => :full_environment do
Idea.find_each do |idea|
idea.update_column :comments_count, idea.comments.count
idea.update_column :votes_cache, idea.votes.count
end
end

desc 'removes bookmarks for old live ideas'
task :bookmark_cleanup => :environment do
require "bookmark_cleanup_service"
task :bookmark_cleanup => :full_environment do
BookmarkCleanupService.new.run
end
end
Expand Down
8 changes: 8 additions & 0 deletions lib/tasks/appfab_users.rake
@@ -0,0 +1,8 @@
namespace :appfab do
namespace :users do
desc 'Saves last-seen timestamps from cache to DB'
task :update_last_seen_at => :full_environment do
User.find_each { |user| user.update_last_seen_at! }
end
end
end
4 changes: 2 additions & 2 deletions lib/tasks/data.rake
Expand Up @@ -2,8 +2,8 @@

namespace :data do

desc 'Re-saves all stored files to make sure nu chunk is larger than a 65k BLOB'
task :fix_storage_chunks => :environment do
desc 'Re-saves all stored files to make sure no chunk is larger than a 65k BLOB'
task :fix_storage_chunks => :full_environment do
Storage::File.find_each do |storage_file|
storage_file.transaction do
old_data = storage_file.data
Expand Down
5 changes: 5 additions & 0 deletions lib/tasks/full_environment.rake
@@ -0,0 +1,5 @@
desc "Eager loads the entire Rails environment"
# see http://stackoverflow.com/questions/4300240/rails-3-rake-task-cant-find-model-in-production
task :full_environment => :environment do
Rails.application.eager_load!
end
11 changes: 0 additions & 11 deletions lib/tasks/users.rake

This file was deleted.

0 comments on commit fa640ee

Please sign in to comment.