-
Notifications
You must be signed in to change notification settings - Fork 169
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
Resque::Plugins::Status::Hash.statuses fails large number of statuses #125
Comments
Hey @akshaymankar Do you have the solution? I have the same issue. |
@jyr You can change ulimit to increase stack size to get around it. |
In case anyone else is still looking at this, we use the following: module MonkeyPatches
module ResqueStatus
module Hash
def self.prepended(base)
base.singleton_class.prepend(ClassMethods)
end
MGET_BATCH_SIZE = 100
module ClassMethods
# Get multiple statuses by UUID. Returns array of Resque::Plugins::Status::Hash
def mget(uuids)
return [] if uuids.empty?
# `mget(uuids)` calls `redis.mget(*status_keys)` that, due to the splat,
# can fail with large list (limit currently unknown), so batch them
uuids.
each_slice(MGET_BATCH_SIZE).
inject([]) do |fetched, slice_of_uuids|
fetched_slice = super(slice_of_uuids) || []
fetched.concat(fetched_slice)
end
end
end
end
end
end
Resque::Plugins::Status::Hash.prepend MonkeyPatches::ResqueStatus::Hash |
This can be fixed by just removing the |
It tries to splat all the status keys and causes a stack level too deep error.
Here: https://github.com/quirkey/resque-status/blob/master/lib/resque/plugins/status/hash.rb#L31
The text was updated successfully, but these errors were encountered: