Skip to content

Commit

Permalink
Merge pull request #481 from neo4jrb/migration
Browse files Browse the repository at this point in the history
fix max per batch value
  • Loading branch information
subvertallchris committed Sep 21, 2014
2 parents 123f45f + c61c757 commit 39f405c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/neo4j/migration.rb
Expand Up @@ -33,7 +33,7 @@ def setup
def add_ids_to(model)
require 'benchmark'

max_per_batch = (ENV['MAX_PER_BATCH'] || max_per_batch).to_i
max_per_batch = (ENV['MAX_PER_BATCH'] || default_max_per_batch).to_i

label = model.mapped_label_name
property = model.primary_key
Expand All @@ -52,8 +52,8 @@ def add_ids_to(model)

return if nodes_left == 0
to_set = [nodes_left, max_per_batch].min
new_ids = to_set.times.map { new_id_for(model) }

new_ids = to_set.times.map { new_id_for(model) }
begin
last_time_taken = Benchmark.realtime do
Neo4j::Session.query("MATCH (n:`#{label}`) WHERE NOT has(n.#{property})
Expand All @@ -72,7 +72,7 @@ def add_ids_to(model)
end
end

def max_per_batch
def default_max_per_batch
900
end

Expand Down

0 comments on commit 39f405c

Please sign in to comment.