def check_account(delay): wrapped = wrap_accounts_minimal(account_manager.get_account(False), account_manager) try: time.sleep(delay) return wrapped.login(location, proceed) except LoginSequenceFail: db_set_perm_banned(wrapped.account_info(), datetime.datetime.now()) except TooManyLoginAttempts: db_set_perm_banned(wrapped.account_info(), datetime.datetime.now()) except AccountBannedException: db_set_temp_banned(wrapped.name(), datetime.datetime.now()) except Exception: log.exception("Something bad happened") num_proxies = len(args.proxy) if args.proxy else 1 if args.login: with ThreadPoolExecutor(thread_count(args)) as pool: futures = [] for counter in range(0, account_manager.size()): futures.append( pool.submit(lambda: check_account(4 if num_proxies < counter < (num_proxies * 2) else 0))) results = [r.result() for r in as_completed(futures)]
except: logging.exception("Outer worker catch block caught exception") load_proxies(args) set_args(args) set_account_db_args(args) account_manager = AccountManager(args.system_id, args.use_account_db, args, [], [], Queue(), {}, replace_warned=False) account_manager.loader = load_accounts_for_blindcheck account_manager.initialize(args.accountcsv, ()) log.info("{} accounts to check".format(str(account_manager.size()))) num_threads = args.threads_per_proxy if args.proxy and len(args.proxy) > 0: num_threads = max(1, len(args.proxy)) * args.threads_per_proxy split = [] for x in range(0, num_threads): split.append([]) for pos in range(0, account_manager.size()): account = wrap_account_no_replace(account_manager.get_account(), account_manager) split[pos % num_threads].append(account)