Add while loop for take a master until someone change master id value in the redis.