Skip to content

Commit

Permalink
fix: pcall(box.ctl.wait_rw) and logs spam in backround fibers
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Grubov committed Jul 22, 2024
1 parent d265333 commit 5919f46
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions xqueue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ function M.upgrade(space,opts,depth)
log.verbose("awaiting rw")
repeat
if box.ctl.wait_rw then
box.ctl.wait_rw(1)
pcall(box.ctl.wait_rw, 1)
else
fiber.sleep(0.001)
end
Expand Down Expand Up @@ -849,11 +849,7 @@ function M.upgrade(space,opts,depth)
repeat fiber.sleep(0.001) until space.xq
if xq.ready then xq.ready:get() end
log.info("I am worker %s",i)
if box.info.ro then
log.info("Shutting down on ro instance")
return
end
while box.space[space.name] and space.xq == xq do
while box.space[space.name] and space.xq == xq and not box.info.ro do
if xq.ready then xq.ready:get() end
local task = space:take(1)
if task then
Expand All @@ -873,6 +869,10 @@ function M.upgrade(space,opts,depth)
end
fiber.yield()
end
if box.info.ro then
log.info("Shutting down on ro instance")
return
end
log.info("worker %s ended", i)
end,space,self)
end
Expand All @@ -888,14 +888,10 @@ function M.upgrade(space,opts,depth)
if xq.ready then xq.ready:get() end
local chan = xq.runat_chan
log.info("Runat started")
if box.info.ro then
log.info("Shutting down on ro instance")
return
end
local maxrun = 1000
local curwait
local collect = {}
while box.space[space.name] and space.xq == xq do
while box.space[space.name] and space.xq == xq and not box.info.ro do
local r,e = pcall(function()
-- print("runat loop 2 ",box.time64())
local remaining
Expand Down Expand Up @@ -972,6 +968,10 @@ function M.upgrade(space,opts,depth)
if curwait == 0 then fiber.sleep(0) end
chan:get(curwait)
end
if box.info.ro then
log.info("Shutting down on ro instance")
return
end
log.info("Runat ended")
end,space,self,runat_index)
end
Expand Down

0 comments on commit 5919f46

Please sign in to comment.