From ac2034feea4e947edb558ae28c753db304f382ab Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Tue, 5 Jul 2022 13:45:48 +0000 Subject: [PATCH] Convert method table.extend() to a local function because 'table' is readonly since Redis 6.2.7 See https://github.com/redis/redis/pull/10651. Fixes #89. Reported-by: Anton Baklanov --- base.lua | 4 ++-- queue.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/base.lua b/base.lua index 73cc977..f77a13c 100644 --- a/base.lua +++ b/base.lua @@ -31,9 +31,9 @@ QlessRecurringJob.__index = QlessRecurringJob Qless.config = {} -- Extend a table. This comes up quite frequently -function table.extend(self, other) +local function extend_table(target, other) for i, v in ipairs(other) do - table.insert(self, v) + table.insert(target, v) end end diff --git a/queue.lua b/queue.lua index 04e8497..370cdfd 100644 --- a/queue.lua +++ b/queue.lua @@ -247,7 +247,7 @@ function QlessQueue:peek(now, count) -- With these in place, we can expand this list of jids based on the work -- queue itself and the priorities therein - table.extend(jids, self.work.peek(count - #jids)) + extend_table(jids, self.work.peek(count - #jids)) return jids end @@ -322,7 +322,7 @@ function QlessQueue:pop(now, worker, count) -- With these in place, we can expand this list of jids based on the work -- queue itself and the priorities therein - table.extend(jids, self.work.peek(count - #jids)) + extend_table(jids, self.work.peek(count - #jids)) local state for index, jid in ipairs(jids) do