`enque` callback called twice when flush is triggered
yo1dog opened this issue · comments
The callback passed to enque
can be called twice if a flush is triggered. The callback is passed both to the queued message and to flush
:
Lines 210 to 223 in 70f24fe
When flush
's done
function is called, the callback is called twice: Once from the callbacks
array (as it was added to the array from the queued message) and again when callback
is called (as it was passed to flush
as the callback
argument).
Lines 265 to 268 in 70f24fe
The fix is to not pass enque
's callback to flush
.
In general, a callback should never have more than 1 handler.