improve wait_for_complete

Signed-off-by: Jack <jack.wgm@gmail.com>