Change setTimeout(0) for setImmediate()