mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 01:36:02 +02:00
Bring back Que gem for painless migration
This commit is contained in:
parent
f8c90e05d3
commit
7210140de6
10 changed files with 84 additions and 82 deletions
4
Gemfile
4
Gemfile
|
@ -64,8 +64,10 @@ gem 'omniauth-tara', github: 'internetee/omniauth-tara'
|
||||||
|
|
||||||
gem 'epp', github: 'internetee/epp', branch: :master
|
gem 'epp', github: 'internetee/epp', branch: :master
|
||||||
gem 'epp-xml', '1.1.0', github: 'internetee/epp-xml'
|
gem 'epp-xml', '1.1.0', github: 'internetee/epp-xml'
|
||||||
gem 'sidekiq'
|
gem 'que'
|
||||||
gem 'daemons-rails', '1.2.1'
|
gem 'daemons-rails', '1.2.1'
|
||||||
|
gem 'que-web'
|
||||||
|
gem 'sidekiq'
|
||||||
gem 'pdfkit'
|
gem 'pdfkit'
|
||||||
gem 'jquery-ui-rails', '5.0.5'
|
gem 'jquery-ui-rails', '5.0.5'
|
||||||
gem 'airbrake'
|
gem 'airbrake'
|
||||||
|
|
21
Gemfile.lock
21
Gemfile.lock
|
@ -190,6 +190,7 @@ GEM
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
concurrent-ruby (1.1.8)
|
concurrent-ruby (1.1.8)
|
||||||
|
connection_pool (2.2.3)
|
||||||
countries (3.1.0)
|
countries (3.1.0)
|
||||||
i18n_data (~> 0.11.0)
|
i18n_data (~> 0.11.0)
|
||||||
sixarm_ruby_unaccent (~> 1.1)
|
sixarm_ruby_unaccent (~> 1.1)
|
||||||
|
@ -301,6 +302,8 @@ GEM
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
msgpack (1.4.2)
|
msgpack (1.4.2)
|
||||||
multi_json (1.15.0)
|
multi_json (1.15.0)
|
||||||
|
mustermann (1.1.1)
|
||||||
|
ruby2_keywords (~> 0.0.1)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nio4r (2.5.7)
|
nio4r (2.5.7)
|
||||||
nokogiri (1.10.10)
|
nokogiri (1.10.10)
|
||||||
|
@ -334,6 +337,11 @@ GEM
|
||||||
public_suffix (4.0.6)
|
public_suffix (4.0.6)
|
||||||
puma (5.2.2)
|
puma (5.2.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
que (0.14.3)
|
||||||
|
que-web (0.7.2)
|
||||||
|
erubis
|
||||||
|
que (~> 0.8)
|
||||||
|
sinatra
|
||||||
rack (2.2.3)
|
rack (2.2.3)
|
||||||
rack-oauth2 (1.16.0)
|
rack-oauth2 (1.16.0)
|
||||||
activesupport
|
activesupport
|
||||||
|
@ -341,6 +349,8 @@ GEM
|
||||||
httpclient
|
httpclient
|
||||||
json-jwt (>= 1.11.0)
|
json-jwt (>= 1.11.0)
|
||||||
rack (>= 2.1.0)
|
rack (>= 2.1.0)
|
||||||
|
rack-protection (2.1.0)
|
||||||
|
rack
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rails (6.0.3.6)
|
rails (6.0.3.6)
|
||||||
|
@ -375,8 +385,8 @@ GEM
|
||||||
activesupport (>= 5.2.4)
|
activesupport (>= 5.2.4)
|
||||||
i18n
|
i18n
|
||||||
rbtree3 (0.6.0)
|
rbtree3 (0.6.0)
|
||||||
regexp_parser (2.1.1)
|
|
||||||
redis (4.2.5)
|
redis (4.2.5)
|
||||||
|
regexp_parser (2.1.1)
|
||||||
request_store (1.5.0)
|
request_store (1.5.0)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
responders (3.0.1)
|
responders (3.0.1)
|
||||||
|
@ -424,6 +434,11 @@ GEM
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
simpleidn (0.1.1)
|
simpleidn (0.1.1)
|
||||||
unf (~> 0.1.4)
|
unf (~> 0.1.4)
|
||||||
|
sinatra (2.1.0)
|
||||||
|
mustermann (~> 1.0)
|
||||||
|
rack (~> 2.2)
|
||||||
|
rack-protection (= 2.1.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
sixarm_ruby_unaccent (1.2.0)
|
sixarm_ruby_unaccent (1.2.0)
|
||||||
socksify (1.7.1)
|
socksify (1.7.1)
|
||||||
sprockets (4.0.2)
|
sprockets (4.0.2)
|
||||||
|
@ -536,6 +551,8 @@ DEPENDENCIES
|
||||||
pg (= 1.2.2)
|
pg (= 1.2.2)
|
||||||
pry (= 0.14.0)
|
pry (= 0.14.0)
|
||||||
puma
|
puma
|
||||||
|
que
|
||||||
|
que-web
|
||||||
rails (~> 6.0)
|
rails (~> 6.0)
|
||||||
ransack (~> 2.3)
|
ransack (~> 2.3)
|
||||||
rest-client
|
rest-client
|
||||||
|
@ -555,4 +572,4 @@ DEPENDENCIES
|
||||||
wkhtmltopdf-binary (~> 0.12.5.1)
|
wkhtmltopdf-binary (~> 0.12.5.1)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.2.2
|
2.2.15
|
||||||
|
|
3
app/models/que_job.rb
Normal file
3
app/models/que_job.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class QueJob < ApplicationRecord
|
||||||
|
self.primary_key = 'job_id'
|
||||||
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
# Que::Adapters::Base::CAST_PROCS[1184] = lambda do |value|
|
Que::Adapters::Base::CAST_PROCS[1184] = lambda do |value|
|
||||||
# case value
|
case value
|
||||||
# when Time then value
|
when Time then value
|
||||||
# when String then Time.parse(value)
|
when String then Time.parse(value)
|
||||||
# else raise "Unexpected time class: #{value.class} (#{value.inspect})"
|
else raise "Unexpected time class: #{value.class} (#{value.inspect})"
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
|
|
|
@ -324,7 +324,7 @@ Rails.application.routes.draw do
|
||||||
resources :bounced_mail_addresses, only: %i[index show destroy]
|
resources :bounced_mail_addresses, only: %i[index show destroy]
|
||||||
|
|
||||||
authenticate :admin_user do
|
authenticate :admin_user do
|
||||||
# mount Que::Web, at: 'que'
|
mount Que::Web, at: 'que'
|
||||||
mount Sidekiq::Web, at: 'sidekiq'
|
mount Sidekiq::Web, at: 'sidekiq'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,43 +1,43 @@
|
||||||
# #!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
#
|
|
||||||
# ENV["RAILS_ENV"] ||= "production"
|
ENV["RAILS_ENV"] ||= "production"
|
||||||
#
|
|
||||||
# root = File.expand_path(File.dirname(__FILE__))
|
root = File.expand_path(File.dirname(__FILE__))
|
||||||
# root = File.dirname(root) until File.exist?(File.join(root, 'config'))
|
root = File.dirname(root) until File.exist?(File.join(root, 'config'))
|
||||||
# Dir.chdir(root)
|
Dir.chdir(root)
|
||||||
#
|
|
||||||
# require File.join(root, "config", "environment")
|
require File.join(root, "config", "environment")
|
||||||
#
|
|
||||||
# # from que gem rake task
|
# from que gem rake task
|
||||||
# if defined?(::Rails) && Rails.respond_to?(:application)
|
if defined?(::Rails) && Rails.respond_to?(:application)
|
||||||
# # ActiveSupport's dependency autoloading isn't threadsafe, and Que uses
|
# ActiveSupport's dependency autoloading isn't threadsafe, and Que uses
|
||||||
# # multiple threads, which means that eager loading is necessary. Rails
|
# multiple threads, which means that eager loading is necessary. Rails
|
||||||
# # explicitly prevents eager loading when the environment task is invoked,
|
# explicitly prevents eager loading when the environment task is invoked,
|
||||||
# # so we need to manually eager load the app here.
|
# so we need to manually eager load the app here.
|
||||||
# Rails.application.eager_load!
|
Rails.application.eager_load!
|
||||||
# end
|
end
|
||||||
#
|
|
||||||
# Que.logger.level = Logger.const_get((ENV['QUE_LOG_LEVEL'] || 'INFO').upcase)
|
Que.logger.level = Logger.const_get((ENV['QUE_LOG_LEVEL'] || 'INFO').upcase)
|
||||||
# Que.worker_count = 1
|
Que.worker_count = 1
|
||||||
# Que.wake_interval = (ENV['QUE_WAKE_INTERVAL'] || 1).to_f
|
Que.wake_interval = (ENV['QUE_WAKE_INTERVAL'] || 1).to_f
|
||||||
# Que.mode = :async
|
Que.mode = :async
|
||||||
#
|
|
||||||
# # When changing how signals are caught, be sure to test the behavior with
|
# When changing how signals are caught, be sure to test the behavior with
|
||||||
# # the rake task in tasks/safe_shutdown.rb.
|
# the rake task in tasks/safe_shutdown.rb.
|
||||||
#
|
|
||||||
# stop = false
|
stop = false
|
||||||
# %w( INT ).each do |signal|
|
%w( INT ).each do |signal|
|
||||||
# trap(signal) { stop = true }
|
trap(signal) { stop = true }
|
||||||
# end
|
end
|
||||||
#
|
|
||||||
# at_exit do
|
at_exit do
|
||||||
# $stdout.puts "Finishing Que's current jobs before exiting..."
|
$stdout.puts "Finishing Que's current jobs before exiting..."
|
||||||
# Que.worker_count = 0
|
Que.worker_count = 0
|
||||||
# Que.mode = :off
|
Que.mode = :off
|
||||||
# $stdout.puts "Que's jobs finished, exiting..."
|
$stdout.puts "Que's jobs finished, exiting..."
|
||||||
# end
|
end
|
||||||
#
|
|
||||||
# loop do
|
loop do
|
||||||
# sleep 1
|
sleep 1
|
||||||
# break if stop
|
break if stop
|
||||||
# end
|
end
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# #!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
# require 'rubygems'
|
require 'rubygems'
|
||||||
# require 'daemons/rails/config'
|
require 'daemons/rails/config'
|
||||||
#
|
config = Daemons::Rails::Config.for_controller(File.expand_path(__FILE__))
|
||||||
# config = Daemons::Rails::Config.for_controller(File.expand_path(__FILE__))
|
Daemons::Rails.run config[:script], config.to_hash
|
||||||
# Daemons::Rails.run config[:script], config.to_hash
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ class DomainDeleteJobTest < ActiveSupport::TestCase
|
||||||
dom = Domain.find_by(id: @domain.id)
|
dom = Domain.find_by(id: @domain.id)
|
||||||
assert dom
|
assert dom
|
||||||
|
|
||||||
DomainDeleteJob.run(@domain.id)
|
DomainDeleteJob.perform_now(@domain.id)
|
||||||
|
|
||||||
dom = Domain.find_by(id: @domain.id)
|
dom = Domain.find_by(id: @domain.id)
|
||||||
assert_nil dom
|
assert_nil dom
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,18 +9,12 @@ class DomainExpireEmailJobTest < ActiveSupport::TestCase
|
||||||
@email = @domain.registrant.email
|
@email = @domain.registrant.email
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_domain_expire
|
|
||||||
success = DomainExpireEmailJob.run(@domain.id, @email)
|
|
||||||
assert success
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_domain_expire_with_force_delete
|
def test_domain_expire_with_force_delete
|
||||||
@domain.update(statuses: [DomainStatus::FORCE_DELETE])
|
@domain.update(statuses: [DomainStatus::FORCE_DELETE])
|
||||||
@domain.reload
|
@domain.reload
|
||||||
assert_equal ['serverForceDelete'], @domain.statuses
|
assert_equal ['serverForceDelete'], @domain.statuses
|
||||||
|
|
||||||
success = DomainExpireEmailJob.run(@domain.id, @email)
|
DomainExpireEmailJob.perform_now(@domain.id, @email)
|
||||||
assert success
|
|
||||||
|
|
||||||
statuses = @domain.statuses
|
statuses = @domain.statuses
|
||||||
statuses.delete(DomainStatus::FORCE_DELETE)
|
statuses.delete(DomainStatus::FORCE_DELETE)
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
require "test_helper"
|
|
||||||
|
|
||||||
class RegenerateRegistrarWhoisesJobTest < ActiveSupport::TestCase
|
|
||||||
setup do
|
|
||||||
travel_to Time.zone.parse('2010-07-05 10:00')
|
|
||||||
@registrar = registrars(:bestnames)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_job_return_true
|
|
||||||
# if return false, then job was failes
|
|
||||||
assert RegenerateRegistrarWhoisesJob.run(@registrar.id)
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Add table
Add a link
Reference in a new issue