so replace `queue = [];` with `queue.length = 0;` ?