Skip to content

Commit 75ea408

Browse files
committed
Fixes method :bury for time64 id
1 parent a135110 commit 75ea408

2 files changed

Lines changed: 33 additions & 11 deletions

File tree

example-tube/init.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,24 @@ do
118118
end
119119
end
120120

121+
box.space.utube:put {
122+
tube = "tube-1",
123+
payload = {
124+
ctime = require 'clock'.realtime64(),
125+
},
126+
nice = 0,
127+
}
128+
129+
do
130+
local task = box.space.utube:take(0)
131+
test:ok(task, ":take returned task from queue")
132+
box.space.utube:bury({ task.id })
133+
134+
task = box.space.utube:get{task.id}
135+
136+
test:ok(task.status, "B", "task was successfully buried")
137+
end
138+
121139
-- clears queue:
122140
box.space.utube:truncate()
123141

xqueue.lua

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,26 +1360,30 @@ function methods:ack(key, attr)
13601360
return t
13611361
end
13621362

1363-
function methods:bury(task, attr)
1364-
local xq = self.xq
1365-
local key = xq:getkey(task)
1366-
local peer = box.session.storage.peer
1367-
local sid = box.session.id()
1368-
attr = attr or {}
1363+
function methods:bury(key, attr)
1364+
attr = attr or {}
13691365

1370-
if xq.debug then
1371-
log.info("Bury {%s} by %s, sid=%s, fid=%s", key, peer, sid, fiber.id())
1372-
end
1366+
local xq = self.xq
1367+
key = xq:getkey(key)
1368+
local t = xq:check_owner(key)
13731369

13741370
local update = {}
13751371
if attr.update then
13761372
for _,v in pairs(attr.update) do table.insert(update,v) end
13771373
end
13781374
table.insert(update, { '=', xq.fields.status, 'B' })
13791375

1380-
self:update({key}, update)
1376+
xq:atomic(key,function()
1377+
t = self:update({key}, update)
13811378

1382-
xq:putback(key, attr)
1379+
xq:wakeup(t)
1380+
if xq.have_runat then
1381+
xq.runat_chan:put(true,0)
1382+
end
1383+
log.info("Bury {%s} by %s, sid=%s, fid=%s", key, box.session.storage.peer, box.session.id(), fiber.id())
1384+
end)
1385+
1386+
xq:putback(t)
13831387
end
13841388

13851389
local function kick_task(self, key, attr)

0 commit comments

Comments
 (0)