use idle watcher to stop loop

Signed-off-by: xiehuc <xiehuc@gmail.com>