def _on_timeout():
    """Invoked periodically to ensure that metrics that have been collected
    are submitted to InfluxDB.

    :rtype: tornado.concurrent.Future or None

    """
    global _buffer_size

    LOGGER.debug('No metrics submitted in the last %.2f seconds',
                 _timeout_interval / 1000.0)
    _buffer_size = _pending_measurements()
    if _buffer_size:
        return _trigger_batch_write()
    _start_timeout()
Invoked periodically to ensure that metrics that have been collected
    are submitted to InfluxDB.

    :rtype: tornado.concurrent.Future or None