Performance: Refresh token pattern
MEDIUM IMPACT
This pattern affects the responsiveness and load of authentication requests, impacting user interaction speed and server load.
async function refreshToken(oldToken) { // Use async non-blocking verification const user = await verifyTokenAsync(oldToken); const newToken = generateToken(user); return newToken; }
async function refreshToken(oldToken) { // Synchronously block to verify and generate new token const user = verifyTokenSync(oldToken); const newToken = generateToken(user); return newToken; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous token verification | 0 | 0 | 0 | [X] Bad |
| Asynchronous token verification | 0 | 0 | 0 | [OK] Good |
| Memory bloat from indefinite token storage | 0 | 0 | 0 | [X] Bad |
| Token storage with expiration and cleanup | 0 | 0 | 0 | [OK] Good |