releaseTempFiles function

void releaseTempFiles(
  1. HttpRequest req
)

call this when the handler of req has ended (or failed). the files are deleted when the response is done and the AfterResponse work has run (AfterResponse work that never ends keeps them for ever). The response can be done early (the client left), so done alone is not a safe time: the handler may still read the files. safe to call many times.

Implementation

void releaseTempFiles(HttpRequest req) {
  List<File>? files = _temps[req];
  if (files == null) return;
  _temps[req] = null;
  _deleteLater(req, files, _late[req]);
}