From 9a94218c1639e365665e9a6326c933e8ff08f5af Mon Sep 17 00:00:00 2001 From: Igor Zolotarev <63460867+yngvar-antonsson@users.noreply.github.com> Date: Tue, 24 Dec 2024 18:23:31 +0300 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Aleksander Klenov --- cartridge/failover.lua | 4 ++-- cartridge/failover/raft.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cartridge/failover.lua b/cartridge/failover.lua index fcb1f3fe9..d908c3f0b 100644 --- a/cartridge/failover.lua +++ b/cartridge/failover.lua @@ -432,7 +432,7 @@ local function synchro_promote() local ok, err = pcall(box.ctl.promote) fiber.testcancel() if ok ~= true then - log.error('Failed to promote: %s', err) + log.error('Failed to promote: %s', err or 'unknown') end return err end @@ -448,7 +448,7 @@ local function synchro_demote() local ok, err = pcall(box.ctl.demote) fiber.testcancel() if ok ~= true then - log.error('Failed to demote: %s', err) + log.error('Failed to demote: %s', err or 'unknown') end return err end diff --git a/cartridge/failover/raft.lua b/cartridge/failover/raft.lua index 37f2dbe18..a1b4570e4 100644 --- a/cartridge/failover/raft.lua +++ b/cartridge/failover/raft.lua @@ -150,9 +150,9 @@ local function disable() and box_info.synchro.queue ~= nil and box_info.synchro.queue.owner ~= 0 and box_info.synchro.queue.owner == box_info.id then - local err = pcall(box.ctl.demote) - if err ~= nil then - log.error('Failed to demote: %s', err) + local ok, err = pcall(box.ctl.demote) + if ok ~= true then + log.error('Failed to demote: %s', err or 'unknown') end return err end