Class: SidekiqTamer::Mongo::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_tamer/mongo/configuration.rb

Constant Summary collapse

MIN_TICKET_THRESHOLD =
80

Class Method Summary collapse

Class Method Details

.clearObject



12
13
14
15
# File 'lib/sidekiq_tamer/mongo/configuration.rb', line 12

def clear()
  ::Mongo::Monitoring::Global.unsubscribe(::Mongo::Monitoring::COMMAND, self)
  @options = {}
end

.passwordObject



21
22
23
# File 'lib/sidekiq_tamer/mongo/configuration.rb', line 21

def password
  get_option_value(:password)
end

.setup(user:, password:, ticket_threshold: MIN_TICKET_THRESHOLD) ⇒ Object



6
7
8
9
10
# File 'lib/sidekiq_tamer/mongo/configuration.rb', line 6

def setup(user:, password:, ticket_threshold: MIN_TICKET_THRESHOLD)
  @options = { user: user, password: password, ticket_threshold: ticket_threshold }
  subscriber = SidekiqTamer::Mongo::CommandSubscriber.new
  ::Mongo::Monitoring::Global.subscribe(::Mongo::Monitoring::COMMAND, subscriber)
end

.ticket_thresholdObject



25
26
27
# File 'lib/sidekiq_tamer/mongo/configuration.rb', line 25

def ticket_threshold
  get_option_value(:ticket_threshold)
end

.userObject



17
18
19
# File 'lib/sidekiq_tamer/mongo/configuration.rb', line 17

def user
  get_option_value(:user)
end