@@ -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