(cid, rdb, r_server, logger)
return success
This method will reset a users failcount
This method will reset a users failcount
This method will reset a users failcount
def resetFailcount(cid, rdb, r_server, logger):
    ''' This method will reset a users failcount '''
    failcount = 0
    success = False
    cacheonly = False

    # Try to set rethinkdb first
    try:
        results = r.table('monitors').get(cid).update(
            {'failcount': failcount}).run(rdb)
        if results['replaced'] == 1:
            success = True
            cacheonly = False
        else:
            success = False
    except (RqlDriverError, RqlRuntimeError) as e:
        success = False
        cacheonly = True
        line = "chstatus: RethinkDB is inaccessible cannot change failcount for %s" % cid
        logger.info(line)
        line = "chstatus: RethinkDB Error: %s" % e.message
        logger.info(line)

    # Then set redis cache
    try:
        r_server.set("monitor:" + cid + ':failcount', failcount)
        success = True
    except:
        line = "chstatus: Redis is inaccessible cannot change failcount for %s" % cid
        logger.info(line)
        success = False

    return success
def resetFailcount ( cid , rdb , r_server , logger ) : failcount = 0 success = False cacheonly = False # Try to set rethinkdb first try : results = r . table ( 'monitors' ) . get ( cid ) . update ( { 'failcount' : failcount } ) . run ( rdb ) if results [ 'replaced' ] == 1 : success = True cacheonly = False else : success = False except ( RqlDriverError , RqlRuntimeError ) as e : success = False cacheonly = True line = "chstatus: RethinkDB is inaccessible cannot change failcount for %s" % cid logger . info ( line ) line = "chstatus: RethinkDB Error: %s" % e . message logger . info ( line ) # Then set redis cache try : r_server . set ( "monitor:" + cid + ':failcount' , failcount ) success = True except : line = "chstatus: Redis is inaccessible cannot change failcount for %s" % cid logger . info ( line ) success = False return success