Example #1
0
def start_daemon(step):
    db_manager = dbmanager.DBManager(world.config['connections']['mysql'],
                                     autoflush=False)
    db = db_manager.get_db()
    try:
        CRATIO = 120
        where = and_(
            db.messages.status == 0, db.messages.type == 'out',
            db.messages.message_version == 2, db.messages.message != '',
            db.messages.message != None,
            func.unix_timestamp(db.messages.dtlasthandleattempt) +
            db.messages.handle_attempts * CRATIO < func.unix_timestamp(
                func.now()))
        msgs = db.messages.filter(where).order_by(desc(db.messages.id)).all()

        world.right_msgs = [
            msg.messageid for msg in msgs if msg.message_name != 'ExecScript'
        ]

        assert len(world.right_msgs) != 0

        config = ETC_DIR + '/config.yml'
        assert lib.start_daemon('msg_sender', config)
    finally:
        db.session.remove()
Example #2
0
def start_daemon(step):
    db_manager = dbmanager.DBManager(world.config['connections']['mysql'], autoflush=False)
    db = db_manager.get_db()
    try:
        CRATIO = 120
        where = and_(db.messages.status == 0, db.messages.type == 'out',
                db.messages.message_version == 2,
                db.messages.message != '',
                db.messages.message != None,
                func.unix_timestamp(db.messages.dtlasthandleattempt) +
                db.messages.handle_attempts * CRATIO < func.unix_timestamp(func.now()))
        msgs = db.messages.filter(where).order_by(desc(db.messages.id)).all()

        world.right_msgs = [
                msg.messageid for msg in msgs if msg.message_name != 'ExecScript']

        assert len(world.right_msgs) != 0

        config = ETC_DIR + '/config.yml'
        assert lib.start_daemon('msg_sender', config)
    finally:
        db.session.remove()
Example #3
0
def start_daemon(step, name):
    config = ETC_DIR + '/config.yml'
    assert lib.start_daemon(name, config)
Example #4
0
def start_daemon(step, name):
    config = ETC_DIR + '/config.yml'
    assert lib.start_daemon(name, config)