Poll QueryEnv in a loop until success response