Module: RailsPodKit

Defined in:
lib/rails_pod_kit/config.rb,
lib/rails_pod_kit/puma.rb,
lib/rails_pod_kit/health.rb,
lib/rails_pod_kit/railtie.rb,
lib/rails_pod_kit/sidekiq.rb,
lib/rails_pod_kit/version.rb,
lib/rails_pod_kit/exporter.rb,
lib/rails_pod_kit/shutdown.rb,
lib/rails_pod_kit/supervisor.rb,
lib/rails_pod_kit/solid_queue.rb,
lib/rails_pod_kit/error_reporter.rb,
lib/rails_pod_kit/global_exporter.rb,
lib/rails_pod_kit/global_scheduler.rb,
lib/rails_pod_kit/solid_queue/metrics.rb,
lib/rails_pod_kit/global_scheduler/heartbeat.rb,
lib/rails_pod_kit/solid_queue/scheduler_runner.rb

Overview

Configuration core, shared by every entry point. The sub-entry points (rails_pod_kit/puma, rails_pod_kit/global_exporter, …) require this file — not the gem's main file — so they can run in Rails-free processes without pulling in railties.

Defined Under Namespace

Modules: ErrorReporter, Exporter, GlobalExporter, GlobalScheduler, Health, Puma, Shutdown, Sidekiq, SolidQueue Classes: Config, Error, Railtie, Supervisor

Constant Summary collapse

DEFAULT_PORT =
9394
VERSION =
File.read(File.expand_path('../../VERSION', __dir__)).chomp.freeze

Class Method Summary collapse

Class Method Details

.configObject



116
117
118
# File 'lib/rails_pod_kit/config.rb', line 116

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



120
121
122
123
# File 'lib/rails_pod_kit/config.rb', line 120

def configure
  yield config if block_given?
  config
end

.enabled?Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/rails_pod_kit/config.rb', line 130

def enabled?
  config.enabled?
end

.reset_config!Object

Test/reset hook — drops the memoized config so a fresh one is built.



126
127
128
# File 'lib/rails_pod_kit/config.rb', line 126

def reset_config!
  @config = nil
end

.scheduler_enabled?(what = 'scheduler') ⇒ Boolean

Gate shared by both hosted schedulers. Says so out loud when it turns one off: a process that starts, stays up and quietly schedules nothing is the one failure this whole feature exists to avoid.

Returns:

  • (Boolean)


137
138
139
140
141
142
# File 'lib/rails_pod_kit/config.rb', line 137

def scheduler_enabled?(what = 'scheduler')
  return true if config.scheduler_enabled?

  warn "[rails_pod_kit] scheduler_enabled=false — #{what} not started"
  false
end