fix(core): Avoid blocking the process when calling flush on empty buffer
#19062
+130
−6
flush on empty buffer
#19062