Skip to content

Commit

Permalink
Add some optional batch_size to rake import
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Feb 1, 2023
1 parent 0ccd15d commit 2e1dd8a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/tasks/client.rake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ namespace :client do

desc "Import all clients"
task import: :environment do
Client.import(index: Client.inactive_index)
batch_size = ENV["BATCH_SIZE"].nil? ? 10 : ENV["BATCH_SIZE"].to_i

Client.import(index: Client.inactive_index, batch_size: batch_size)
end

desc "Delete from index by query"
Expand Down
4 changes: 3 additions & 1 deletion lib/tasks/prefix.rake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ namespace :prefix do

desc "Import all prefixes"
task import: :environment do
Prefix.import(index: ENV["INDEX"] || Prefix.inactive_index, batch_size: (ENV["BATCH_SIZE"] || 100).to_i)
batch_size = ENV["BATCH_SIZE"].nil? ? 100 : ENV["BATCH_SIZE"].to_i

Prefix.import(index: ENV["INDEX"] || Prefix.inactive_index, batch_size: batch_size)
end

desc "Create alias for prefixes"
Expand Down
4 changes: 3 additions & 1 deletion lib/tasks/provider.rake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ namespace :provider do

desc "Import all providers"
task import: :environment do
Provider.import(index: Provider.inactive_index)
batch_size = ENV["BATCH_SIZE"].nil? ? 10 : ENV["BATCH_SIZE"].to_i

Provider.import(index: Provider.inactive_index, batch_size: batch_size)
end

desc "Export all providers to Salesforce"
Expand Down
4 changes: 3 additions & 1 deletion lib/tasks/provider_prefix.rake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ namespace :provider_prefix do

desc "Import all provider_prefixes"
task import: :environment do
ProviderPrefix.import(index: ENV["INDEX"] || ProviderPrefix.inactive_index, batch_size: (ENV["BATCH_SIZE"] || 100).to_i)
batch_size = ENV["BATCH_SIZE"].nil? ? 100 : ENV["BATCH_SIZE"].to_i

ProviderPrefix.import(index: ENV["INDEX"] || ProviderPrefix.inactive_index, batch_size: batch_size)
end

desc "Create alias for provider_prefixes"
Expand Down

0 comments on commit 2e1dd8a

Please sign in to comment.