From 288414d339692e3a9a92d1419cbfa48e1fc12538 Mon Sep 17 00:00:00 2001 From: Pedro Baracho Date: Tue, 28 Feb 2023 17:52:51 -0800 Subject: [PATCH] Manually patch qless lua scripts to work with Redis 6.2.7 More context: - [qless fix](https://github.com/ledgetech/lua-resty-qless/pull/14) - [redis 6.2.7 breaking change](https://github.com/redis/redis/pull/10651) I did not regenerate the files from qless-core using the `make` instructions from the README.md because the commit we have been using [^1] dates back to Aug 2017, and the same fix has not been applied to seomoz/qless-core yet. See [^2] [^1]: https://github.com/seomoz/qless-core/commit/36199bfcabc3216b754bb75fa9912a1d48f0b1b4 [^2]: https://github.com/seomoz/qless-core/pull/90 --- lib/qless/lua/qless-lib.lua | 6 +++--- lib/qless/lua/qless.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/qless/lua/qless-lib.lua b/lib/qless/lua/qless-lib.lua index b8daf8b0..32c34091 100644 --- a/lib/qless/lua/qless-lib.lua +++ b/lib/qless/lua/qless-lib.lua @@ -33,7 +33,7 @@ QlessRecurringJob.__index = QlessRecurringJob Qless.config = {} -- Extend a table. This comes up quite frequently -function table.extend(self, other) +local function extend_table(self, other) for i, v in ipairs(other) do table.insert(self, v) end @@ -1522,7 +1522,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 @@ -1597,7 +1597,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 diff --git a/lib/qless/lua/qless.lua b/lib/qless/lua/qless.lua index dd1f6871..7ed79904 100644 --- a/lib/qless/lua/qless.lua +++ b/lib/qless/lua/qless.lua @@ -24,7 +24,7 @@ QlessRecurringJob.__index = QlessRecurringJob Qless.config = {} -function table.extend(self, other) +local function extend_table(self, other) for i, v in ipairs(other) do table.insert(self, v) end @@ -1118,7 +1118,7 @@ function QlessQueue:peek(now, count) self:check_scheduled(now, count - #jids) - table.extend(jids, self.work.peek(count - #jids)) + extend_table(jids, self.work.peek(count - #jids)) return jids end @@ -1167,7 +1167,7 @@ function QlessQueue:pop(now, worker, count) self:check_scheduled(now, count - #jids) - 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