def test_connection(): try: global conn conn.ping() except: conn = getDatabase() return conn
import requests, gevent, time from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor # from urllib import parse # import asyncio from queue import Queue import gevent.pool import pymysql, logging, redis supervisory = ["jd.com", "1688.com", "b2b.baidu.com"] # from config_log import config_log from multiprocessing import Pool from config_log import * Header = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36", } conn = getDatabase() # q = multiprocessing.Queue(8) flag_1688 = {} flag_jd = {} flag_b2bbaidu = {} pool_task = gevent.pool.Pool(10) executor_thread = ThreadPoolExecutor(max_workers=12) def test_connection(): try: global conn conn.ping() except: