it's simple:
```
wait_until = now() + self._log_timeout
try:
  while len(items) < self._bulk_size:
    items.append(self._queue.get(timeout=max(wait_until - now(), 0)))
    self._queue.task_done()
except queue.Empty:
  wait_until = now() + self._log_timeout
```