retry query after connect