FIX: Revert Demon::DemonBase back to Demon::Base (#8132)
I introduced DemonBase because I had got some conflict between `demon/base.rb` and `jobs/base.rb`, however, to not rename base class, it is possible to use regex on absolute path in Zeitwerk custom inflector.
This commit is contained in:
parent
55ee9abecb
commit
35b1185a08
|
@ -3,7 +3,7 @@
|
||||||
module Demon; end
|
module Demon; end
|
||||||
|
|
||||||
# intelligent fork based demonizer
|
# intelligent fork based demonizer
|
||||||
class Demon::DemonBase
|
class Demon::Base
|
||||||
|
|
||||||
def self.demons
|
def self.demons
|
||||||
@demons
|
@demons
|
||||||
|
@ -57,7 +57,7 @@ class Demon::DemonBase
|
||||||
def alive?(pid = nil)
|
def alive?(pid = nil)
|
||||||
pid ||= @pid
|
pid ||= @pid
|
||||||
if pid
|
if pid
|
||||||
Demon::DemonBase.alive?(pid)
|
Demon::Base.alive?(pid)
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
@ -143,7 +143,7 @@ class Demon::DemonBase
|
||||||
def already_running?
|
def already_running?
|
||||||
if File.exists? pid_file
|
if File.exists? pid_file
|
||||||
pid = File.read(pid_file).to_i
|
pid = File.read(pid_file).to_i
|
||||||
if Demon::DemonBase.alive?(pid)
|
if Demon::Base.alive?(pid)
|
||||||
return pid
|
return pid
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "demon/demon_base"
|
require "demon/base"
|
||||||
|
|
||||||
class Demon::RailsAutospec < Demon::DemonBase
|
class Demon::RailsAutospec < Demon::Base
|
||||||
|
|
||||||
def self.prefix
|
def self.prefix
|
||||||
"rails-autospec"
|
"rails-autospec"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "demon/demon_base"
|
require "demon/base"
|
||||||
|
|
||||||
class Demon::Sidekiq < ::Demon::DemonBase
|
class Demon::Sidekiq < ::Demon::Base
|
||||||
|
|
||||||
def self.prefix
|
def self.prefix
|
||||||
"sidekiq"
|
"sidekiq"
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
module ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector
|
module ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector
|
||||||
CUSTOM_PATHS = {
|
CUSTOM_PATHS = {
|
||||||
'base' => 'Jobs',
|
|
||||||
'canonical_url' => 'CanonicalURL',
|
'canonical_url' => 'CanonicalURL',
|
||||||
'clean_up_unmatched_ips' => 'CleanUpUnmatchedIPs',
|
'clean_up_unmatched_ips' => 'CleanUpUnmatchedIPs',
|
||||||
'homepage_constraint' => 'HomePageConstraint',
|
'homepage_constraint' => 'HomePageConstraint',
|
||||||
|
@ -18,8 +17,9 @@ module ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector
|
||||||
'version' => 'Discourse',
|
'version' => 'Discourse',
|
||||||
}
|
}
|
||||||
|
|
||||||
def self.camelize(basename, _abspath)
|
def self.camelize(basename, abspath)
|
||||||
return basename.camelize if _abspath =~ /onceoff\.rb$/
|
return basename.camelize if abspath =~ /onceoff\.rb$/
|
||||||
|
return 'Jobs' if abspath =~ /jobs\/base\.rb$/
|
||||||
CUSTOM_PATHS.fetch(basename, basename.camelize)
|
CUSTOM_PATHS.fetch(basename, basename.camelize)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ require File.expand_path("../../../config/environment", __FILE__)
|
||||||
|
|
||||||
puts "Parent is now loaded"
|
puts "Parent is now loaded"
|
||||||
|
|
||||||
class ForkExecDemon < Demon::DemonBase
|
class ForkExecDemon < Demon::Base
|
||||||
def self.prefix
|
def self.prefix
|
||||||
"fork-exec-child"
|
"fork-exec-child"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue