Skip to content

Commit

Permalink
utubettl: remove extra sleep from utubettl_fiber
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekBum committed May 21, 2024
1 parent f6c0770 commit 7613c79
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Too long timings in the `utubettl` driver (#223)

## [1.4.0] - 2024-05-20

The release introduces an experimental `storage_mode` option for the `utube`
Expand Down
11 changes: 6 additions & 5 deletions queue/abstract/driver/utubettl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,12 @@ local function utubettl_fiber(self)
elseif stat then
processed = err
end
end

if self.sync_chan:get(0.1) ~= nil then
log.info("Queue utubettl fiber was stopped")
break
else
-- When switching the master to the replica, the fiber will be stopped.
if self.sync_chan:get(0.1) ~= nil then
log.info("Queue utubettl fiber was stopped")
break
end
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions t/040-utubettl.t
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ test:test('ttr put/take', function(test)
local my_queue = queue.create_tube('trr_test', 'utubettl', { engine = engine })
test:ok(my_queue:put('ttr1', { ttr = 1 }), 'put ttr task')
test:ok(my_queue:take(0.1) ~= nil, 'take this task')
fiber.sleep(1.5)
fiber.sleep(1.1)
local task = my_queue:peek(0)
test:is(task[2], state.READY, 'Ready state returned after one second')

Expand All @@ -132,7 +132,7 @@ test:test('ttr put/take', function(test)
{ engine = engine, storage_mode = queue.driver.utubettl.STORAGE_MODE_READY_BUFFER })
test:ok(my_queue_ready:put('ttr1', { ttr = 1 }), 'put ttr task')
test:ok(my_queue_ready:take(0.1) ~= nil, 'take this task')
fiber.sleep(1.5)
fiber.sleep(1.1)
local task = my_queue_ready:peek(0)
test:is(task[2], state.READY, 'Ready state returned after one second')
end
Expand Down

0 comments on commit 7613c79

Please sign in to comment.