Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevented duplicated parallel HTTP calls #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zonia3000
Copy link

@zonia3000 zonia3000 commented Oct 23, 2024

Salve,

notavo che l'app effettua svariate richieste identiche in parallelo agli endpoint index.json (es: https://nodc.ogs.it/erddap/info/E2M3A_TS/index.json).

Ho dato un'occhiata al meccanismo di caching implementato nei file cache.interceptor.ts e cache.service.ts e ho visto che il dato viene inserito nella cache solo quando la risposta HTTP è completata. Pertanto eventuali richieste identiche che partono in parallelo vengono comunque eseguite tutte.

Dovrebbe esser possibile gestire richieste che partono in parallelo inserendo nella cache degli oggetti di tipo Observable al posto degli oggetti HttpResponse.

Ho visto che l'attuale implementazione sembra esser presa da qua: https://stackoverflow.com/a/56590462

Per le modifiche proposte in questa PR invece ho preso spunto da qua: https://stackoverflow.com/q/63303537

Ulteriore nota: né l'implementazione attuale né quella proposta rimuovono gli oggetti inseriti nella cache.

Checklist

  • I have read the contribution guidelines.
  • First PR targets the master branch (ignore for branch specific issues).
  • All the build checks are green.
  • New unit tests have been added covering the changes.
  • Documentation has been updated (if change is visible to end users).
  • Bug fixes and small new features are presented as a single commit.
  • Each commit has a single objective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant