Performance: Timeout interceptor
MEDIUM IMPACT
This affects server response time and user interaction speed by limiting how long a request can take before being aborted.
import { timeout } from 'rxjs/operators'; intercept(context, next) { return next.handle().pipe(timeout(5000)); // 5 seconds timeout }
async intercept(context, next) { return next.handle().toPromise(); // no timeout applied }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No timeout interceptor | N/A (server-side) | N/A | N/A | [X] Bad |
| Timeout interceptor with 5s limit | N/A (server-side) | N/A | N/A | [OK] Good |