Calculate final timing information and return headers to add.
(self, request: Request)
| 175 | self.after_request_func() |
| 176 | |
| 177 | def _finalize_timing(self, request: Request) -> dict | None: |
| 178 | """Calculate final timing information and return headers to add.""" |
| 179 | if not self.enable_timing or not hasattr(request.state, "timing_information"): |
| 180 | return None |
| 181 | |
| 182 | timing_information = request.state.timing_information |
| 183 | dash_total = timing_information.get("__dash_server", None) |
| 184 | if dash_total is not None: |
| 185 | dash_total["dur"] = round((time.time() - dash_total["dur"]) * 1000) |
| 186 | |
| 187 | return timing_information |
| 188 | |
| 189 | async def _handle_error( |
| 190 | self, error: Exception, scope: Scope, receive: Receive, send: Send |