Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeding timeout #15595

Merged
merged 1 commit into from
Aug 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/evm_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ def self.seed(classes = nil, exclude_list = [])
classes ||= PRIMORDIAL_CLASSES + (seedable_model_class_names - PRIMORDIAL_CLASSES)
classes -= exclude_list

lock_timeout = (ENV["SEEDING_LOCK_TIMEOUT"].presence || 10.minutes).to_i
# Only 1 machine can go through this at a time
# Populating the DB takes 20 seconds
# Not populating the db takes 3 seconds
MiqDatabase.with_lock(10.minutes) do
MiqDatabase.with_lock(lock_timeout) do
classes.each do |klass|
begin
klass = klass.constantize if klass.kind_of?(String)
Expand All @@ -90,6 +89,9 @@ def self.seed(classes = nil, exclude_list = [])
end

_log.info("Seeding... Complete")
rescue Timeout::Error
_log.error("Timed out seeding database (#{lock_timeout} seconds).")
raise
end

def self.host
Expand Down