Run a function within a pending-work scope. Whatever fn resolves to, the
queue is drained once more on the way out: an error logged after the
request's own flush (e.g. while the response is finalised) still queues
work, and work that outlived its request would complete during whatever
runs next — on Bunny that's a killed fetch, in tests a sanitizer failure
in an unrelated test.
Usage
import { runWithPendingWork } from "doc.ts";