def METHOD_NAME(log):
    """Maintain the http_queue table in the database"""
    log.debug("QM: Started")
    conn = pscheduler.pg_connection(dsn)
    # Start listenig
    with conn as db:
        with db.cursor() as cursor:
            # Don't catch anything here; if it dies, it dies.
            cursor.execute("LISTEN run_change")
            log.debug("QM: Listening")
    # Work forever
    while True:
        # Process what needs processing
        log.debug("QM: Processing")
        with conn as db:
            with db.cursor() as cursor:
                try:
                    cursor.execute("""SELECT http_queue_process_all()""")
                except Exception as ex:
                    log.warning("Queue maintainer got exception %s", str(ex))
        # Wait for the next notification or our usual delay.
        try:
            if pscheduler.polled_select([db], [], [], 15) != ([], [], []):
                # Notified
                db.poll()
                del db.notifies[:]
                log.debug("QM: Queue change.")
        except select.error as ex:
            err_no, message = ex.args
            if err_no != errno.EINTR:
                log.exception()
                raise ex