query refresh in thread