Skip to content

Commit 6451a52

Browse files
author
Алексей Зорькин
committed
utubettl-on-task-change: commit after on_task_change
1 parent a8f5e6b commit 6451a52

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313

1414
### Fixed
1515

16+
## [1.4.5] - 2025-09-22
17+
18+
Race condition between utubettl_fiber_iteration fiber and other operation.
19+
20+
### Fixed
21+
22+
- Erasing the task entry from _queue_taken_2 in the `utubettl` driver by
23+
a race condition between utubettl_fiber_iteration fiber and other operation.
24+
1625
## [1.4.4] - 2025-05-26
1726

1827
The patch release fixes incorrect behavior of the utubettl driver with enabled

queue/abstract/driver/utubettl.lua

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ local function utubettl_fiber_iteration(self, processed)
207207
local estimated = util.MAX_TIMEOUT
208208

209209
local commit_func = begin_if_not_in_txn(self)
210-
local commited = false
211210

212211
-- delayed tasks
213212
task = self.space.index.watch:min(delayed_state)
@@ -221,8 +220,6 @@ local function utubettl_fiber_iteration(self, processed)
221220
if self.ready_space_mode then
222221
update_ready(self, task[i_id], task[i_utube], task[i_pri])
223222
end
224-
commit_func()
225-
commited = true
226223

227224
self:on_task_change(task, 'delayed')
228225
estimated = 0
@@ -231,12 +228,13 @@ local function utubettl_fiber_iteration(self, processed)
231228
estimated = tonumber(task[i_next_event] - now) / 1000000
232229
end
233230
end
234-
if not commited then
235-
commit_func()
236-
end
231+
232+
commit_func()
237233

238234
-- ttl tasks
239235
for _, state in pairs(ttl_states) do
236+
commit_func = begin_if_not_in_txn(self)
237+
240238
task = self.space.index.watch:min{ state }
241239
if task ~= nil and task[i_status] == state then
242240
if now >= task[i_next_event] then
@@ -249,10 +247,12 @@ local function utubettl_fiber_iteration(self, processed)
249247
estimated = et < estimated and et or estimated
250248
end
251249
end
250+
251+
commit_func()
252252
end
253253

254254
commit_func = begin_if_not_in_txn(self)
255-
commited = false
255+
256256
-- ttr tasks
257257
task = self.space.index.watch:min(ttr_state)
258258
if task and task[i_status] == state.TAKEN then
@@ -265,8 +265,6 @@ local function utubettl_fiber_iteration(self, processed)
265265
if self.ready_space_mode then
266266
put_ready(self, task[i_id], task[i_utube], task[i_pri])
267267
end
268-
commit_func()
269-
commited = true
270268

271269
self:on_task_change(task, 'ttr')
272270
estimated = 0
@@ -276,9 +274,8 @@ local function utubettl_fiber_iteration(self, processed)
276274
estimated = et < estimated and et or estimated
277275
end
278276
end
279-
if not commited then
280-
commit_func()
281-
end
277+
278+
commit_func()
282279

283280
if estimated > 0 or processed > 1000 then
284281
-- free refcounter

0 commit comments

Comments
 (0)