Skip to content

Commit

Permalink
Fix for race condition in queue creation. closes tarantoolgh-50
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbes committed Jan 16, 2017
1 parent b2016c7 commit 24d730c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions queue/abstract.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,15 @@ function method.create_tube(tube_name, tube_type, opts)
return self
end

-- create tube space
local space = driver.create_space(space_name, opts)

-- create tube record
local last = box.space._queue.index.tube_id:max()
local tube_id = 0
if last ~= nil then
tube_id = last[2] + 1
end

-- create tube space
local space = driver.create_space(space_name, opts)
local self = make_self(driver, space, tube_name, tube_type, tube_id, opts)
opts.on_task_change = nil
box.space._queue:insert{tube_name, tube_id, space_name, tube_type, opts}
Expand Down

0 comments on commit 24d730c

Please sign in to comment.