Module: SolidQueueGuard::PumaPluginSupport Private

Defined in:
lib/solid_queue_guard/puma_plugin_support.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

PUMA_PLUGIN_PATTERN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/plugin\s+:?solid_queue/
ASYNC_MODE_PATTERN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/solid_queue_mode\s+:?async/

Class Method Summary collapse

Class Method Details

.async_supervisor_mode?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


31
32
33
# File 'lib/solid_queue_guard/puma_plugin_support.rb', line 31

def async_supervisor_mode?
  ENV.fetch('SOLID_QUEUE_SUPERVISOR_MODE', 'fork').casecmp('async').zero? || puma_async_mode?
end

.puma_async_mode?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


26
27
28
29
# File 'lib/solid_queue_guard/puma_plugin_support.rb', line 26

def puma_async_mode?
  content = puma_config_content
  content.present? && content.match?(ASYNC_MODE_PATTERN)
end

.puma_config_contentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
# File 'lib/solid_queue_guard/puma_plugin_support.rb', line 15

def puma_config_content
  return unless puma_config_path.exist?

  puma_config_path.read
end

.puma_config_pathObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'lib/solid_queue_guard/puma_plugin_support.rb', line 11

def puma_config_path
  Rails.root.join('config/puma.rb')
end

.puma_plugin_enabled?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/solid_queue_guard/puma_plugin_support.rb', line 21

def puma_plugin_enabled?
  content = puma_config_content
  content.present? && content.match?(PUMA_PLUGIN_PATTERN)
end