#780: update batch_size
This commit is contained in:
parent
4a8045ecfb
commit
9ea5f47e45
|
@ -67,25 +67,26 @@ namespace :new_core do
|
||||||
BuildList::BUILD_PUBLISH
|
BuildList::BUILD_PUBLISH
|
||||||
]).
|
]).
|
||||||
order(:id).
|
order(:id).
|
||||||
find_in_batches(:batch_size => 1) do | bls |
|
find_in_batches(:batch_size => 100) do | build_lists |
|
||||||
|
|
||||||
bl = bls.first
|
build_lists.each do | bl |
|
||||||
puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}"
|
puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}"
|
||||||
|
|
||||||
sha1 = (bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ } || {})['sha1']
|
sha1 = (bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ } || {})['sha1']
|
||||||
next unless sha1
|
next unless sha1
|
||||||
dir = Dir.mktmpdir('update-packages-', "#{APP_CONFIG['root_path']}")
|
dir = Dir.mktmpdir('update-packages-', "#{APP_CONFIG['root_path']}")
|
||||||
begin
|
begin
|
||||||
system "cd #{dir} && curl -L -O #{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}; tar -xzf #{sha1}"
|
system "cd #{dir} && curl -L -O #{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}; tar -xzf #{sha1}"
|
||||||
system "rm -f #{dir}/#{sha1}"
|
system "rm -f #{dir}/#{sha1}"
|
||||||
|
|
||||||
extract_rpms_and_update_packages("#{dir}/archives/SRC_RPM", bl, 'source', token)
|
extract_rpms_and_update_packages("#{dir}/archives/SRC_RPM", bl, 'source', token)
|
||||||
extract_rpms_and_update_packages("#{dir}/archives/RPM", bl, 'binary', token)
|
extract_rpms_and_update_packages("#{dir}/archives/RPM", bl, 'binary', token)
|
||||||
ensure
|
ensure
|
||||||
# remove the directory.
|
# remove the directory.
|
||||||
FileUtils.remove_entry_secure dir
|
FileUtils.remove_entry_secure dir
|
||||||
end
|
end
|
||||||
end
|
end # build_lists.each
|
||||||
|
end # find_in_batches
|
||||||
|
|
||||||
say "[#{Time.zone.now}] done"
|
say "[#{Time.zone.now}] done"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue