def set_timeout(milliseconds):
    """Override the maximum duration to wait for submitting measurements to
    InfluxDB.

    :param int milliseconds: Maximum wait in milliseconds

    """
    global _timeout, _timeout_interval

    LOGGER.debug('Setting batch wait timeout to %i ms', milliseconds)
    _timeout_interval = milliseconds
    _maybe_stop_timeout()
    _timeout = ioloop.IOLoop.current().add_timeout(milliseconds, _on_timeout)