mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
Code cleanup: simplify comment and remove unnecessary variable
- Simplified comment on line 165 to explain WHY (prevent memory leaks) instead of WHAT - Removed unnecessary requestId variable, passing config.id directly to createWaitingTimeout Addresses feedback on lines 165 and 169. Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
This commit is contained in:
parent
6062bd1461
commit
2fc0f2df4a
@ -162,11 +162,8 @@ export function defaultRequestInterceptor(axios: AxiosCacheInstance): RequestInt
|
||||
// others waiting for it.
|
||||
def.catch(() => undefined);
|
||||
|
||||
// Set a timeout to automatically clean up the waiting entry to prevent memory leaks
|
||||
// when entries are evicted from storage before the response completes.
|
||||
// The timeout logic is handled inside createWaitingTimeout
|
||||
const requestId = config.id;
|
||||
const timeoutId = createWaitingTimeout(axios, requestId, def, config);
|
||||
// Prevent memory leaks when cache entries are evicted before responses complete
|
||||
const timeoutId = createWaitingTimeout(axios, config.id, def, config);
|
||||
|
||||
// Clear the timeout if the deferred is resolved/rejected to avoid unnecessary cleanup
|
||||
// Only add the finally handler if a timeout was actually created
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user