mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(POOLER-150) Synchronize checkout operations for API
This commit adds a shared mutex to vmpooler API so that checkout requests can be synchronized across threads. Without this change it is possible in some scenarios for vmpooler to allocate the same SUT to different API requests for a VM.
This commit is contained in:
parent
79bd140ab9
commit
30bf2074fe
6 changed files with 27 additions and 14 deletions
|
|
@ -24,7 +24,8 @@ if torun.include? 'api'
|
|||
api = Thread.new do
|
||||
thr = Vmpooler::API.new
|
||||
redis = Vmpooler.new_redis(redis_host, redis_port, redis_password)
|
||||
thr.helpers.configure(config, redis, metrics)
|
||||
checkoutlock = Mutex.new
|
||||
thr.helpers.configure(config, redis, metrics, checkoutlock)
|
||||
thr.helpers.execute!
|
||||
end
|
||||
torun_threads << api
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue