From 80bf8632c6db5698a91fac09a3a7cc91ece1caff Mon Sep 17 00:00:00 2001 From: Oleg Jukovec Date: Fri, 12 May 2023 15:32:34 +0300 Subject: [PATCH] bugfix: call queue.cfg() before box.cfg() We don't have stable results if queue.cfg({in_replicaset = true}) is called after box.cfg(). Probably it is expected [1]. 1. https://github.com/tarantool/queue/issues/206 Part of #278 --- queue/example_connection_pool_test.go | 7 +++++++ queue/testdata/pool.lua | 3 +++ 2 files changed, 10 insertions(+) diff --git a/queue/example_connection_pool_test.go b/queue/example_connection_pool_test.go index e41cdc639..5425d6c39 100644 --- a/queue/example_connection_pool_test.go +++ b/queue/example_connection_pool_test.go @@ -61,6 +61,13 @@ func (h *QueueConnectionHandler) Discovered(conn *tarantool.Connection, // Set up a queue module configuration for an instance. q := queue.New(conn, h.name) + + // Set up a queue module configuration for an instance. Ideally, this + // should be done before box.cfg({}) or you need to wait some time + // before start a work. + // + // See: + // https://github.com/tarantool/queue/issues/206 opts := queue.CfgOpts{InReplicaset: true, Ttr: 60 * time.Second} if h.err = q.Cfg(opts); h.err != nil { diff --git a/queue/testdata/pool.lua b/queue/testdata/pool.lua index 1bcc11654..9ca98bbf1 100644 --- a/queue/testdata/pool.lua +++ b/queue/testdata/pool.lua @@ -25,6 +25,9 @@ end local queue = require('queue') rawset(_G, 'queue', queue) +-- queue.cfg({in_replicaset = true}) should be called before box.cfg({}) +-- https://github.com/tarantool/queue/issues/206 +queue.cfg({in_replicaset = true, ttr = 60}) local listen = os.getenv("TEST_TNT_LISTEN") box.cfg{