flush method

void flush()

Ships whatever has accumulated.

Implementation

void flush() {
  _timer?.cancel();
  _timer = null;
  if (_pending.isEmpty) return;

  final batch = List<String>.of(_pending);
  _pending.clear();
  try {
    send(batch);
  } on Object {
    // The link is down. Dropping the batch is the point: a node's log tail is
    // about what is happening now, and an agent that queues forever is an agent
    // that eventually eats the machine.
  }
}