Skip to content

Commit

Permalink
Add SolidQueue.supervisor? to signal that we're running as a SQ super…
Browse files Browse the repository at this point in the history
…visor process

We only want to do certain things in that case, such as emitting global metrics.
  • Loading branch information
rosa committed Nov 1, 2023
1 parent b9e8228 commit 5390165
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/solid_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ module SolidQueue
mattr_accessor :shutdown_timeout, default: 5.seconds

mattr_accessor :supervisor_pidfile
mattr_accessor :supervisor, default: false

def self.supervisor?
supervisor
end
end
1 change: 1 addition & 0 deletions lib/solid_queue/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Supervisor

class << self
def start(mode: :work, load_configuration_from: nil)
SolidQueue.supervisor = true
configuration = Configuration.new(mode: mode, load_from: load_configuration_from)

new(configuration.runners).start
Expand Down

0 comments on commit 5390165

Please sign in to comment.