Skip to content

Commit ff31de0

Browse files
committedJun 25, 2014
Merge pull request #11 from gofullstack/actually-verify-cookbook-versions
Actually verify cookbook versions as part of the migration
2 parents 39e2953 + 6a89a0f commit ff31de0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎lib/tasks/supermarket/import.rake

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ namespace :supermarket do
99
cullings = [:users, :cookbooks, :cookbook_following, :cookbook_collaboration].
1010
map { |c| "cull:#{c}" }
1111

12-
task :migrate => imports + cullings + ['amend:cookbooks', 'amend:users']
12+
task :migrate => imports + cullings + ['amend:cookbooks', 'amend:users',
13+
'verify:cookbook_versions']
1314

1415
namespace :import do
1516
#

‎lib/tasks/supermarket/verify.rake

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ namespace :supermarket do
99
where(dependencies_imported: true).
1010
where('legacy_id IS NOT ?', nil)
1111

12-
verification_frequency = 8 # every 3 hours: 24 / 3 = 8
12+
# each batch should be ~1000 cookbook versions
13+
batch_divisor = base_scope.count / 1000
1314
batch_size = [
14-
base_scope.count / verification_frequency,
15-
verification_frequency
15+
base_scope.count / batch_divisor,
16+
batch_divisor
1617
].max
1718

1819
batch_scope = base_scope.

0 commit comments

Comments
 (0)
Please sign in to comment.