New About Yours API Help
922 bytes, Python 2
def process_endpoints(process_extras=False):
    logger = logging.getLogger(__name__)
    logger.info("Initiating endpoint processing.")
    # Fix strptime bug by calling it once before creating threads
    datetime.strptime('x', 'x')
    start = datetime.now()
    pool = ThreadPool(10)
    func = partial(endpoint_thread, logger, process_extras)
    result = pool.map(func, get_endpoints(db))
    pool.close()
    pool.join()
    if abort.is_set():
        return
    end = datetime.now()
    result.sort(key=lambda tup: tup[1], reverse=True)
    # Just to prevent Exception when scanning fewer than 3 endpoints
    result.append(('NONE', 0))
    result.append(('NONE', 0))
    logger.info("Complete run duration: {}, slowest was {} at {} "
                "then comes {} and {}"
                .format(end - start, result[0][0], result[0][1],
                        result[1][0], result[2][0]))
Pasted 1 day, 12 hours ago — Expires in 6 days
URL: http://dpaste.com/0NA1SHH