Ejemplo n.º 1
0
def get_live_build_output():
    """


    """

    psub = db.pubsub()
    psub.subscribe('build-output')
    first_run = True
    keep_alive = 0
    while True:
        message = psub.get_message()
        if message:
            if first_run and (message['data'] == '1' or message['data'] == 1):
                message['data'] = db.get('build_log_last_line')
                first_run = False
            elif message['data'] == '1' or message['data'] == 1:
                message['data'] = '...'

            yield 'event: build_output\ndata: %s\n\n' % message['data']
        elif keep_alive > 600:
            keep_alive = 0
            yield ':'

        keep_alive += 1
        gevent.sleep(.05)

    psub.close()
Ejemplo n.º 2
0
def get_live_build_ouput():
    psub = db.pubsub()
    psub.subscribe('build-output')
    first_run = True
    while True:
        message = psub.get_message()
        if message:
            if first_run and (message['data'] == '1' or message['data'] == 1):
                message['data'] = db.get('build_log_last_line')
                first_run = False
            elif message['data'] == '1' or message['data'] == 1:
                message['data'] = '...'

            yield 'data: %s\n\n' % message['data']

        gevent.sleep(.05)

    psub.close()