- Removed waitingTimeout from CacheProperties (too much configuration)
- Moved timeout logic into createWaitingTimeout utility function
- Use config.timeout or axios.defaults.timeout for timeout value
- Only add finally handler if timeout was actually created
- Updated tests to use axios.defaults.timeout instead
Addresses comments 2599033372, 2599040440, and 2599040616.
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
- Add waitingTimeout property to CacheProperties for configurable timeout
- Extract timeout logic to waiting-timeout.ts utility function
- Store request ID outside timeout callback to allow earlier GC
- Add unref() to timeout in Node.js to prevent keeping process alive
- Fix timeout logic to handle axios default timeout of 0
- Only create timeout when explicitly configured or config.timeout > 0
Changes address comments 2598940999, 2598944866, and 2598947753.
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
- Add timeout mechanism to automatically clean up waiting entries after axios timeout period
- Use axios config timeout or default to 30 seconds if not configured
- This prevents memory leaks when entries are evicted from storage before response completes
- Updated tests to use short timeouts and wait for cleanup to complete
Note: This implements the approach requested by @arthurfiorette to use axios timeout
instead of immediately resolving/rejecting waiting entries when cache state is not loading.
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
- Created resolveWaiting helper function to centralize the logic for resolving and cleaning up waiting entries
- Simplified test error message to avoid redundancy
- This improves code maintainability by avoiding duplication
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
- Added cleanup of waiting map entries in response interceptor when cache state is not 'loading'
- This prevents memory leaks when entries are evicted from storage due to maxEntries limit
- Added comprehensive tests to verify the fix
- Updated existing test to reflect correct behavior
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
* feature: added stale flag in request return object
* feature: added stale flag in request return object
* feat: added stale flag in request return object
* feat: added stale flag in request return object
* chore: fixed lint issues
* refactor: change id generation location
* fix: lint
* refactor: ensures id will be created only if cache is not false
* chore(deps-dev): bump vitepress from 1.0.0-beta.5 to 1.0.0-beta.6 (#618)
* chore(deps-dev): bump @types/node from 18.16.19 to 18.17.0 (#617)
* chore(deps-dev): bump tslib from 2.6.0 to 2.6.1 (#619)
* chore(deps-dev): bump @types/node from 18.17.0 to 18.17.1 (#620)
* chore: dependabot
* ci: dependabot
* feat: handle non axios errors rejections (#609)
* fix: correct config re throw
* chore(deps-dev): bump eslint-config-prettier from 8.8.0 to 8.9.0 (#624)
* chore(deps-dev): bump jest from 29.6.1 to 29.6.2 (#622)
* feat: turn most types into interfaces (#615)
* Turn most types into interfaces
* Turn 'CacheAxiosResponse' into a interface
* Update docs
* Change docs to be more didactic
* chore(deps-dev): bump jest-environment-jsdom from 29.6.1 to 29.6.2 (#623)
* chore: removed unused eslint comment
* feat: handle errors on object-code
* feat: bring back ids
* chore: lint
---------
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arthur Fiorette <arthur.fiorette@gmail.com>
Co-authored-by: Denis Rossati <denis.rossatiramos@gmail.com>