process page views in parallel for multiple shards

Change-Id: Ief4bb4e51248ad1bc005522735b52c6329b7c50d
Reviewed-on: https://gerrit.instructure.com/11246
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
This commit is contained in:
Cody Cutrer 2012-06-03 04:54:30 -06:00
parent 52d0ca856e
commit 5fd6bf9ded
2 changed files with 5 additions and 1 deletions

View File

@ -73,7 +73,7 @@ if PageView.page_view_method == :cache
# periodically pull new page views off the cache and insert them into the db
Delayed::Periodic.cron 'PageView.process_cache_queue', '*/1 * * * *' do
Shard.with_each_shard do
PageView.process_cache_queue
PageView.send_later_enqueue_args(:process_cache_queue, :singleton => "PageView.process_cache_queue:#{Shard.current.description}")
end
end
end

View File

@ -49,6 +49,10 @@ class Shard
{}
end
def description
"default"
end
yaml_as "tag:instructure.com,2012:Shard"
def self.yaml_new(klass, tag, val)