def enter(**kwargs): start = kwargs["start"] end = kwargs["end"] c = redisutil.connect() lst = c.lrange("91", start, end) for a in lst: print(threading.current_thread().name, " parsing url ", a) parse(a, c) time.sleep(random.randint(1, 3))
def enter(**kwargs): start = kwargs["start"] end = kwargs["end"] c = redisutil.connect() lst = c.lrange(common.KEY, int(start), int(end)) for a in lst: print(threading.current_thread().name, " parsing url ", a) parse(a, c) time.sleep(0.1) with open(common.PARSE_LOG, "a") as f: f.write(threading.current_thread().name + " 已经解析完毕.\n")