variable runWithPendingWork

Run fn, then drain the queue 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. The request entry composes this runner around the handler, so the drain runs inside the live request context.

Type

ScopeRunner

Usage

import { runWithPendingWork } from "doc.ts";