Class: Rjob::Scripts::ScanBuckets
- Inherits:
-
RedisScript
- Object
- RedisScript
- Rjob::Scripts::ScanBuckets
- Defined in:
- lib/rjob/scripts/scan_buckets.rb
Instance Attribute Summary
Attributes inherited from RedisScript
Instance Method Summary collapse
Methods inherited from RedisScript
Instance Method Details
#arg_params ⇒ Object
4 5 6 |
# File 'lib/rjob/scripts/scan_buckets.rb', line 4 def arg_params i(prefix bucket_count) end |
#lua_script ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rjob/scripts/scan_buckets.rb', line 8 def lua_script " local prefix = ARGV[1]\n local bucket_count = ARGV[2]\n local r = redis\n local i\n for i=0,bucket_count-1 do\n local len = r.call('llen', prefix .. ':jobs:' .. i)\n if len > 0 then\n r.call('publish', prefix .. ':jobs', i)\n end\n end\n return 1\n LUA\nend\n" |