Resolve redis query race condition