Simplify declaration of checkoutlock mutex

This commit updates the way that checkoutlock is defined so it is not passed through bin/vmpooler. Without this change there's an unnecessary layer the mutex passes through.
This commit is contained in:
kirby@puppetlabs.com 2019-10-23 03:52:08 -07:00
parent 30bf2074fe
commit 0e1a6da043
2 changed files with 3 additions and 4 deletions

View file

@ -24,8 +24,7 @@ if torun.include? 'api'
api = Thread.new do api = Thread.new do
thr = Vmpooler::API.new thr = Vmpooler::API.new
redis = Vmpooler.new_redis(redis_host, redis_port, redis_password) redis = Vmpooler.new_redis(redis_host, redis_port, redis_password)
checkoutlock = Mutex.new thr.helpers.configure(config, redis, metrics)
thr.helpers.configure(config, redis, metrics, checkoutlock)
thr.helpers.execute! thr.helpers.execute!
end end
torun_threads << api torun_threads << api

View file

@ -36,11 +36,11 @@ module Vmpooler
use Vmpooler::API::Reroute use Vmpooler::API::Reroute
use Vmpooler::API::V1 use Vmpooler::API::V1
def configure(config, redis, metrics, checkoutlock) def configure(config, redis, metrics)
self.settings.set :config, config self.settings.set :config, config
self.settings.set :redis, redis self.settings.set :redis, redis
self.settings.set :metrics, metrics self.settings.set :metrics, metrics
self.settings.set :checkoutlock, checkoutlock self.settings.set :checkoutlock, Mutex.new
end end
def execute! def execute!