Sha256: 8396e4d0acfafc1a69a1ff81a19d4c6218920ff7a9de237dcfe3d9b01edafa18

Contents?: true

Size: 1.24 KB

Versions: 8

Compression:

Stored size: 1.24 KB

Contents

class ExpandSyncTimeoutSettings < ActiveRecord::Migration[6.0]
  def up
    old_timeout_setting = Setting.find_by(name: 'sync_connect_timeout', category: 'Setting::Content')
    if old_timeout_setting && (old_timeout_setting&.value != old_timeout_setting&.default)
      Setting.find_by(name: 'sync_total_timeout')&.update(value: old_timeout_setting&.value)
      Setting.find_by(name: 'sync_sock_read_timeout')&.update(value: old_timeout_setting&.value)
    end
    Setting.where(name: 'sync_connect_timeout', category: 'Setting::Content').delete_all
  end

  def down
    timeout = Setting.find_by(name: 'sync_total_timeout', category: 'Setting::Content')&.value

    Setting.where(name: 'sync_total_timeout', category: 'Setting::Content').delete_all
    Setting.where(name: 'sync_connect_timeout_v2', category: 'Setting::Content').delete_all
    Setting.where(name: 'sync_sock_connect_timeout', category: 'Setting::Content').delete_all
    Setting.where(name: 'sync_sock_read_timeout', category: 'Setting::Content').delete_all

    Setting.create(Setting.set('sync_connect_timeout', N_("Timeout in seconds for downloads when syncing"),
      300, N_('Sync Connection Timeout')))
    Setting.find_by(name: 'sync_connect_timeout')&.update(value: timeout)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
katello-4.4.2.2 db/migrate/20220209205137_expand_sync_timeout_settings.rb
katello-4.4.2.1 db/migrate/20220209205137_expand_sync_timeout_settings.rb
katello-4.4.2 db/migrate/20220209205137_expand_sync_timeout_settings.rb
katello-4.4.1 db/migrate/20220209205137_expand_sync_timeout_settings.rb
katello-4.4.0.2 db/migrate/20220209205137_expand_sync_timeout_settings.rb
katello-4.4.0.1 db/migrate/20220209205137_expand_sync_timeout_settings.rb
katello-4.4.0 db/migrate/20220209205137_expand_sync_timeout_settings.rb
katello-4.4.0.rc2 db/migrate/20220209205137_expand_sync_timeout_settings.rb