better online history write

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