[Rails] Update to rails 6

Fix sidekiq initializer
This commit is contained in:
Kira 2021-02-07 17:24:14 -08:00
parent 3628bd8f09
commit 048e5d7182
4 changed files with 148 additions and 152 deletions

View File

@ -2,7 +2,7 @@ source 'https://rubygems.org/'
gem 'dotenv-rails', require: 'dotenv/rails-now'
gem "rails", "~> 6.0"
gem "rails", "~> 6.1"
gem "pg"
gem "dalli", :platforms => :ruby
gem "simple_form"

View File

@ -16,111 +16,100 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.3)
actionpack (= 6.0.3.3)
actioncable (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.3)
actionpack (= 6.0.3.3)
activejob (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
actionmailbox (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
mail (>= 2.7.1)
actionmailer (6.0.3.3)
actionpack (= 6.0.3.3)
actionview (= 6.0.3.3)
activejob (= 6.0.3.3)
actionmailer (6.1.1)
actionpack (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activesupport (= 6.1.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.3)
actionview (= 6.0.3.3)
activesupport (= 6.0.3.3)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.1)
actionview (= 6.1.1)
activesupport (= 6.1.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.3)
actionpack (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
actiontext (6.1.1)
actionpack (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
nokogiri (>= 1.8.5)
actionview (6.0.3.3)
activesupport (= 6.0.3.3)
actionview (6.1.1)
activesupport (= 6.1.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.10)
actionpack (>= 4.1, < 6.1)
activemodel (>= 4.1, < 6.1)
active_model_serializers (0.10.12)
actionpack (>= 4.1, < 6.2)
activemodel (>= 4.1, < 6.2)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (6.0.3.3)
activesupport (= 6.0.3.3)
activejob (6.1.1)
activesupport (= 6.1.1)
globalid (>= 0.3.6)
activemodel (6.0.3.3)
activesupport (= 6.0.3.3)
activemodel (6.1.1)
activesupport (= 6.1.1)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (6.0.3.3)
activemodel (= 6.0.3.3)
activesupport (= 6.0.3.3)
activestorage (6.0.3.3)
actionpack (= 6.0.3.3)
activejob (= 6.0.3.3)
activerecord (= 6.0.3.3)
activerecord (6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
activestorage (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activesupport (= 6.1.1)
marcel (~> 0.3.1)
activesupport (6.0.3.3)
mimemagic (~> 0.3.2)
activesupport (6.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
awesome_print (1.8.0)
bcrypt (3.1.16)
bootsnap (1.4.8)
bootsnap (1.7.1)
msgpack (~> 1.0)
brpoplpush-redis_script (0.1.1)
concurrent-ruby (~> 1.0, >= 1.0.5)
redis (>= 1.0, <= 5.0)
buftok (0.2.0)
builder (3.2.4)
byebug (11.1.3)
capistrano (3.14.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.0.1)
capistrano (~> 3.1)
capistrano-deploytags (1.0.7)
capistrano (>= 3.7.0)
capistrano-rails (1.6.1)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
capistrano3-unicorn (0.2.1)
capistrano (~> 3.1, >= 3.1.0)
case_transform (0.2)
activesupport
chronic (0.10.2)
cityhash (0.9.0)
coderay (1.1.3)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
crack (0.4.4)
crack (0.4.5)
rexml
crass (1.0.6)
daemons (1.3.1)
dalli (2.7.11)
diff-lcs (1.4.4)
docile (1.3.2)
docile (1.3.5)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
@ -133,33 +122,34 @@ GEM
activemodel-serializers-xml (>= 1.0)
activesupport (>= 5.0)
request_store (>= 1.0)
elasticsearch (7.9.0)
elasticsearch-api (= 7.9.0)
elasticsearch-transport (= 7.9.0)
elasticsearch-api (7.9.0)
elasticsearch (7.10.1)
elasticsearch-api (= 7.10.1)
elasticsearch-transport (= 7.10.1)
elasticsearch-api (7.10.1)
multi_json
elasticsearch-model (7.1.1)
activesupport (> 3)
elasticsearch (> 1)
hashie
elasticsearch-rails (7.1.1)
elasticsearch-transport (7.9.0)
elasticsearch-transport (7.10.1)
faraday (~> 1)
multi_json
equalizer (0.0.11)
erubi (1.9.0)
erubi (1.10.0)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
faraday (1.0.1)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
faraday-net_http (1.0.1)
ffaker (2.17.0)
ffi (1.13.1)
ffi (1.13.1-x64-mingw32)
ffi (1.14.2)
ffi (1.14.2-x64-mingw32)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
ffi-win32-extensions (1.0.4)
ffi
get_process_mem (0.2.7)
ffi (~> 1.0)
globalid (0.4.2)
@ -174,26 +164,26 @@ GEM
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (2.3.0)
http-parser (1.2.1)
http-parser (1.2.3)
ffi-compiler (>= 1.0, < 2.0)
http_parser.rb (0.6.0)
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
i18n (1.8.5)
i18n (1.8.8)
concurrent-ruby (~> 1.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.3.1)
json (2.5.1)
jsonapi-renderer (0.2.2)
jwt (2.2.2)
kgio (2.11.3)
listen (3.2.1)
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.7.0)
loofah (2.9.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@ -202,7 +192,7 @@ GEM
rest-client (~> 2.0.2)
marcel (0.3.3)
mimemagic (~> 0.3.2)
mechanize (2.7.6)
mechanize (2.7.7)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0)
mime-types (>= 1.17.2)
@ -210,6 +200,7 @@ GEM
net-http-persistent (>= 2.5.2)
nokogiri (~> 1.6)
ntlm-http (~> 0.1, >= 0.1.1)
webrick (~> 1.7)
webrobots (>= 0.0.9, < 0.2)
memoist (0.16.2)
memoizable (0.4.2)
@ -217,17 +208,17 @@ GEM
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512)
mime-types-data (3.2020.1104)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.5.0)
minitest (5.14.2)
minitest (5.14.3)
minitest-ci (3.4.0)
minitest (>= 5.0.6)
mocha (1.11.2)
mock_redis (0.26.0)
msgpack (1.3.3)
msgpack (1.3.3-x64-mingw32)
mocha (1.12.0)
mock_redis (0.27.3)
ruby2_keywords
msgpack (1.4.2)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
@ -235,22 +226,20 @@ GEM
ruby2_keywords (~> 0.0.1)
naught (1.1.0)
net-http-digest_auth (1.4.1)
net-http-persistent (4.0.0)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-sftp (3.0.0)
net-ssh (>= 5.0.0, < 7.0.0)
net-ssh (6.1.0)
netrc (0.11.0)
newrelic_rpm (6.13.1)
nio4r (2.5.4)
newrelic_rpm (6.15.0)
nio4r (2.5.5)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogiri (1.11.1-x64-mingw32)
racc (~> 1.4)
nokogumbo (2.0.2)
nokogumbo (2.0.4)
nokogiri (~> 1.8, >= 1.8.4)
ntlm-http (0.1.1)
oauth2 (1.4.4)
@ -267,9 +256,7 @@ GEM
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
ptools (1.4.0)
ptools (1.4.0-universal-mingw32)
win32-file
ptools (1.4.2)
public_suffix (4.0.6)
racc (1.5.2)
rack (2.2.3)
@ -280,41 +267,41 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
radix62 (1.0.1)
rails (6.0.3.3)
actioncable (= 6.0.3.3)
actionmailbox (= 6.0.3.3)
actionmailer (= 6.0.3.3)
actionpack (= 6.0.3.3)
actiontext (= 6.0.3.3)
actionview (= 6.0.3.3)
activejob (= 6.0.3.3)
activemodel (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
bundler (>= 1.3.0)
railties (= 6.0.3.3)
rails (6.1.1)
actioncable (= 6.1.1)
actionmailbox (= 6.1.1)
actionmailer (= 6.1.1)
actionpack (= 6.1.1)
actiontext (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activemodel (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
bundler (>= 1.15.0)
railties (= 6.1.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.3)
actionpack (= 6.0.3.3)
activesupport (= 6.0.3.3)
railties (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
thor (~> 1.0)
raindrops (0.19.1)
rake (13.0.1)
rake (13.0.3)
rakismet (1.5.4)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
recaptcha (5.5.0)
recaptcha (5.7.0)
json
redis (4.2.2)
redis (4.2.5)
request_store (1.5.0)
rack (>= 1.4)
responders (3.0.1)
@ -330,34 +317,38 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retriable (3.1.2)
rexml (3.2.4)
ruby-vips (2.0.17)
ffi (~> 1.9)
ruby2_keywords (0.0.2)
ruby2_keywords (0.0.4)
rubyzip (2.3.0)
sanitize (5.2.1)
sanitize (5.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.8.0)
nokogumbo (~> 2.0)
semantic_range (2.3.0)
semantic_range (2.3.1)
shoulda-context (2.0.0)
shoulda-matchers (4.4.1)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
sidekiq (6.1.2)
sidekiq (6.1.3)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
sidekiq-unique-jobs (6.0.24)
sidekiq-unique-jobs (7.0.1)
brpoplpush-redis_script (> 0.0.0, <= 2.0.0)
concurrent-ruby (~> 1.0, >= 1.0.5)
sidekiq (>= 4.0, < 7.0)
sidekiq (>= 5.0, < 7.0)
thor (>= 0.20, < 2.0)
simple_form (5.0.3)
actionpack (>= 5.0)
activemodel (>= 5.0)
simple_oauth (0.3.1)
simplecov (0.19.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.2)
@ -370,16 +361,13 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.21.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
statistics2 (0.54)
streamio-ffmpeg (3.0.2)
multi_json (~> 1.8)
thor (1.0.1)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.10)
timecop (0.9.1)
timecop (0.9.2)
twitter (7.0.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
@ -391,41 +379,35 @@ GEM
multipart-post (~> 2.0)
naught (~> 1.0)
simple_oauth (~> 0.3.0)
tzinfo (1.2.7)
thread_safe (~> 0.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unf_ext (0.0.7.7-x64-mingw32)
unicorn (5.7.0)
unicorn (5.8.0)
kgio (~> 2.6)
raindrops (~> 0.7)
unicorn-worker-killer (0.4.4)
get_process_mem (~> 0)
unicorn (>= 4, < 6)
webmock (3.9.1)
webmock (3.11.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.2.1)
webpacker (6.0.0.pre.2)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
webrick (1.7.0)
webrobots (0.1.2)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (1.0.0)
chronic (>= 0.6.3)
win32-file (0.8.2)
ffi
ffi-win32-extensions
win32-file-stat (>= 1.4.0)
win32-file-stat (1.5.5)
ffi
ffi-win32-extensions
zeitwerk (2.4.0)
zeitwerk (2.4.2)
PLATFORMS
ruby
@ -437,11 +419,6 @@ DEPENDENCIES
awesome_print
bcrypt
bootsnap
capistrano (~> 3.10)
capistrano-deploytags (~> 1.0.0)
capistrano-rails
capistrano-rbenv
capistrano3-unicorn
cityhash
daemons
dalli
@ -469,7 +446,7 @@ DEPENDENCIES
pry-byebug
ptools
radix62 (~> 1.0.1)
rails (~> 6.0)
rails (~> 6.1)
rakismet
recaptcha
redis

View File

@ -2,7 +2,7 @@
class IndexUpdateJob
include Sidekiq::Worker
sidekiq_options queue: 'high_prio', lock: :until_executing, unique_args: ->(args) { args[1] }
sidekiq_options queue: 'high_prio', lock: :until_executing
def perform(klass, id)
begin
@ -12,4 +12,9 @@ class IndexUpdateJob
return
end
end
def unique_args(args)
Rails.logger.error("Unique args called: #{args.inspect}")
[args[1]]
end
end

View File

@ -2,8 +2,22 @@ require 'sidekiq'
Sidekiq.configure_server do |config|
config.redis = { url: Danbooru.config.redis_url }
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
end
config.server_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Server
end
SidekiqUniqueJobs::Server.configure(config)
end
Sidekiq.configure_client do |config|
config.redis = { url: Danbooru.config.redis_url }
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
end
end