to avoid spinning how about calling blpop first, then lpop for the remainder?

```
table.insert(res, redis.call('blpop', KEYS[1]))
while (i > 1) do ...
```