diff --git a/CHANGELOG.md b/CHANGELOG.md index fd81bcc..0b11b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. (#256). - The `utubettl` driver could accumulate tasks in the status `READY` without deleting (#261). +- `queue._VERSION` was `nil` if the module was loaded on an instance that was + already in read-write mode (#260). ## [1.5.0] - 2026-07-10 diff --git a/queue/abstract.lua b/queue/abstract.lua index fb92ba8..7f9410b 100644 --- a/queue/abstract.lua +++ b/queue/abstract.lua @@ -38,7 +38,8 @@ local queue = { return not (self[tube_name] == nil) end }), - stat = {} + stat = {}, + _VERSION = require('queue.version'), } -- Release tasks that don't have session_uuid stored in inactive sessions. diff --git a/queue/init.lua b/queue/init.lua index c3d6183..04c3bee 100644 --- a/queue/init.lua +++ b/queue/init.lua @@ -48,7 +48,7 @@ queue = setmetatable({ register_driver = register_driver, state = queue_state.show, cfg = deferred_cfg, - _VERSION = require('queue.version'), + _VERSION = abstract._VERSION, }, { __index = function(self, key) -- In replicaset mode, the user can attempt to call public methods on the replica start. -- For example, a single script is used for master and replica. diff --git a/t/000-init.t b/t/000-init.t index ee7b9e2..c652648 100755 --- a/t/000-init.t +++ b/t/000-init.t @@ -10,8 +10,9 @@ local queue = require('queue') local engine = os.getenv('ENGINE') or 'memtx' test:test('access to queue until box.cfg is started', function(test) - test:plan(3) + test:plan(4) test:isnil(rawget(box, 'space'), 'box is not started yet') + test:is(queue._VERSION, require('queue.version'), 'queue._VERSION') local s, e = pcall(function() return queue.tube end) test:ok(not s, 'exception was generated') @@ -24,7 +25,8 @@ local tnt = require('t.tnt') tnt.cfg{} test:test('access to queue after box.cfg{}', function(test) - test:plan(9) + test:plan(10) + test:is(queue._VERSION, require('queue.version'), 'queue._VERSION') test:istable(queue.tube, 'queue.tube is table') test:is(#queue.tube, 0, 'queue.tube is empty') diff --git a/t/270-version.t b/t/270-version.t new file mode 100755 index 0000000..f097c3f --- /dev/null +++ b/t/270-version.t @@ -0,0 +1,18 @@ +#!/usr/bin/env tarantool +local tap = require('tap') +local tnt = require('t.tnt') + +local test = tap.test('module version') +test:plan(1) + +-- The instance is writable before the module is loaded, so the queue +-- starts at once, without the "lazy start". +tnt.cfg{} +local queue = require('queue') + +test:is(queue._VERSION, require('queue.version'), + 'queue._VERSION after start on a writable instance') + +tnt.finish() +os.exit(test:check() and 0 or 1) +-- vim: set ft=lua :