Class: Semian::ThreadSafe::PIDController

Inherits:
Simple::PIDController show all
Defined in:
lib/semian/pid_controller.rb

Overview

Thread-safe version of PIDController

Instance Attribute Summary

Attributes inherited from Simple::PIDController

#rejection_rate

Instance Method Summary collapse

Methods inherited from Simple::PIDController

#metrics

Constructor Details

#initialize(**kwargs) ⇒ PIDController

Returns a new instance of PIDController.



191
192
193
194
# File 'lib/semian/pid_controller.rb', line 191

def initialize(**kwargs)
  super(**kwargs)
  @lock = Mutex.new
end

Instance Method Details

#record_request(outcome) ⇒ Object



196
197
198
# File 'lib/semian/pid_controller.rb', line 196

def record_request(outcome)
  @lock.synchronize { super }
end

#resetObject



208
209
210
# File 'lib/semian/pid_controller.rb', line 208

def reset
  @lock.synchronize { super }
end

#should_reject?Boolean

Returns:

  • (Boolean)


204
205
206
# File 'lib/semian/pid_controller.rb', line 204

def should_reject?
  @lock.synchronize { super }
end

#updateObject



200
201
202
# File 'lib/semian/pid_controller.rb', line 200

def update
  @lock.synchronize { super }
end