Stop a timeout if it's running, and then write the measurements.

def _trigger_batch_write():
    """Stop a timeout if it's running, and then write the measurements."""
    global _batch_future

    LOGGER.debug('Batch write triggered (%r/%r)',
                 _buffer_size, _trigger_size)
    _maybe_stop_timeout()
    _maybe_warn_about_buffer_size()
    _batch_future = _write_measurements()
    return _batch_future