Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
420 B
Ruby
Raw Permalink Normal View History

2023-09-29 15:03:32 +01:00
require "timeout"
timeout = (ENV["WAIT_FOR_DB_TIMEOUT_SECONDS"] || 120).to_i
Timeout::timeout(timeout) do
loop do
2023-10-09 06:55:53 +02:00
puts "[#{DateTime.now}] waiting for db to be ready and migrated"
2023-09-29 15:03:32 +01:00
sleep 4
begin
2025-03-08 11:57:30 +08:00
ActiveRecord::Migration.check_all_pending!
2023-09-29 15:03:32 +01:00
puts "[#{DateTime.now}] db ready"
exit 0
rescue StandardError => e
puts "[#{DateTime.now}] not ready yet: #{e.message}"
end
end
end