Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
Manually patch qless lua scripts to work with Redis 6.2.7
Browse files Browse the repository at this point in the history
More context:
- [qless fix](ledgetech/lua-resty-qless#14)
- [redis 6.2.7 breaking
  change](redis/redis#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]: seomoz/qless-core@36199bf

[^2]: seomoz/qless-core#90
  • Loading branch information
pedropb committed Mar 1, 2023
1 parent 1d689d6 commit cc379e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/qless/lua/qless-lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/qless/lua/qless.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ QlessRecurringJob.__index = QlessRecurringJob

Qless.config = {}

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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cc379e4

Please sign in to comment.