// Read a managed-job stream to completion, discarding chunks. Used when the // caller doesn't render the log but needs to wait until the job's fn has // finished (e.g. so a subsequent revalidate reads freshly-written files). export async function drainStream( stream: ReadableStream, ): Promise { const reader = stream.getReader(); try { while (true) { const { done } = await reader.read(); if (done) return; } } finally { reader.releaseLock(); } }