Bug in imbalance check ("Queue length off by X")
telenskyt opened this issue · 1 comments
telenskyt commented
I got this suspicious message:
Queue length off by 227...correcting
It seems that this code contains a bug:
# Check for imbalance in: queued + started + finished = total.
nq = length(setdiff(names(task_list), c(finished, started)))
if(queued < nq)
{
warning("Queue length off by ",nq,"...correcting")
replicate(nq,redisRPush(queue, ID))
}
Perhaps it should be like:
warning("Queue length off by ",nq - queued,"...correcting")
replicate(nq - queued,redisRPush(queue, ID))
But I am not sure about this logic at all - even after this fix this part of code looks very suspicious to me. Isn't it just some kind of a dirty hack? I am not sure if this part of code couldn't be contributing to issues like #14 or similar. This leads me to question
How can this imbalance happen? Shouldn't ve better try to prevent it?
I use R 3.1.0, doRedis 1.1.1, rredis 1.6.9 on Windows XP and redis server 2.8.8 on remote linux machine.
bwlewis commented
This should be fixed in the latest version 1.2.0 (on GitHub now, soon to be on CRAN). Re-open if the issue is not fixed for you.