我有一个简单的 Lua 脚本:
while ( i < 500000 ) do
redis.call("zadd", 'test1', i, i)
redis.call( "expire", 'test1', 600 )
i = i + 1
end
local res = redis.call("zrange", "test1", 0, 500000 )
for k,a in pairs(res) do
redis.call("zadd", 'test2',k,a)
end
为什么这个脚本会阻塞 Redis 服务器?如果我在另一个控制台命令中运行,例如:set test 1,结果:
BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.