mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-22 22:06:40 +00:00
Refactor RuboCop configuration, update Puma plugin to use $PROCESS_ID, and simplify ORM setter in RabbitCarrots configuration
This commit is contained in:
parent
d9bbd242d6
commit
753457a704
@ -5,7 +5,7 @@ AllCops:
|
|||||||
SuggestExtensions: false
|
SuggestExtensions: false
|
||||||
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Layout/LineLength:
|
Layout/LineLength:
|
||||||
Max: 350
|
Max: 350
|
||||||
Lint/AmbiguousAssignment: # (new in 1.7)
|
Lint/AmbiguousAssignment: # (new in 1.7)
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -110,4 +110,8 @@ Metrics/MethodLength:
|
|||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Max: 15
|
Max: 15
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 15
|
Max: 15
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Max: 150
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
Max: 6
|
||||||
@ -1,4 +1,5 @@
|
|||||||
# rabbit_carrots.rb
|
# rabbit_carrots.rb
|
||||||
|
require 'English'
|
||||||
require 'puma/plugin'
|
require 'puma/plugin'
|
||||||
require 'rabbit_carrots'
|
require 'rabbit_carrots'
|
||||||
|
|
||||||
@ -7,7 +8,7 @@ Puma::Plugin.create do
|
|||||||
|
|
||||||
def start(launcher)
|
def start(launcher)
|
||||||
@log_writer = launcher.log_writer
|
@log_writer = launcher.log_writer
|
||||||
@puma_pid = $$
|
@puma_pid = $PROCESS_ID
|
||||||
|
|
||||||
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ Puma::Plugin.create do
|
|||||||
loop do
|
loop do
|
||||||
if send(process_dead)
|
if send(process_dead)
|
||||||
log message
|
log message
|
||||||
Process.kill('TERM', $$)
|
Process.kill('TERM', $PROCESS_ID)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
@ -24,8 +24,6 @@ module RabbitCarrots
|
|||||||
@orm ||= :activerecord
|
@orm ||= :activerecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def orm=(value)
|
attr_writer :orm
|
||||||
@orm = value
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,6 +3,7 @@ require 'singleton'
|
|||||||
module RabbitCarrots
|
module RabbitCarrots
|
||||||
class Connection
|
class Connection
|
||||||
include ::Singleton
|
include ::Singleton
|
||||||
|
|
||||||
attr_reader :connection
|
attr_reader :connection
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user