Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua script bug #489

Closed
yaoyi opened this issue Apr 5, 2020 · 2 comments · Fixed by #494
Closed

Lua script bug #489

yaoyi opened this issue Apr 5, 2020 · 2 comments · Fixed by #494
Assignees

Comments

@yaoyi
Copy link

yaoyi commented Apr 5, 2020

current implementation

local cursor = "0"
repeat
  local pagination  = redis.call("SCAN", cursor, "MATCH", "*queue:*", "COUNT", count)
  local next_cursor = pagination[1]
  local queues      = pagination[2]
  for _, queue in ipairs(queues) do
    ...
    cursor = next_cursor
    ...
  end
until found == true or cursor == "0"

when next cursor is not 0, the queues still could be empty, so should not put cursor = next_cursor inside the for loop which might let cursor have no chance to get updated

@mhenrixon
Copy link
Owner

Thanks for the report @yaoyi, I’ll have a look at this today.

@mhenrixon mhenrixon self-assigned this Apr 5, 2020
mhenrixon added a commit that referenced this issue Apr 9, 2020
mhenrixon added a commit that referenced this issue Apr 9, 2020
* Extract reapers into separate classes

The one class was having too many responsibilities

* Fix cursor assignment

Close #489

* Update reek
@mhenrixon
Copy link
Owner

Released as v7.0.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants