use thread global var to check if new connection needed [ci skip]