Commit ac7488fd authored by Ian Baum's avatar Ian Baum

Add retry logic to add_licenses

Retry 10 times, waiting 6 seconds in between to add the license
parent 4c61d9f3
......@@ -471,14 +471,21 @@ check_docs_internal_links:
content = File.read("/tmp/license.gitlab").strip;
FileUtils.rm_f("/tmp/license.gitlab");
unless License.where(data:content).empty?
puts "License already exists";
Kernel.exit 0;
end
unless License.new(data: content).save
puts "Could not add license";
Kernel.exit 0;
10.times do |x|
begin
unless License.where(data:content).empty?
puts "License already exists";
Kernel.exit 0;
end
unless License.new(data: content).save
puts "Could not add license";
Kernel.exit 0;
end
rescue StandardError
puts "Database not ready yet. Try #{x+1} of 10"
sleep 6
end
end
puts "License added";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment