for bug #237, refine the thread loop for publish thread. 2.0.47