[REQUEST] Option to not cache errors

Aperta
#258 0 commenti 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
backend

Direzione di ricerca

Inizia leggendo il comportamento di caching di DataLoader per load e batch-load, in particolare il modo in cui vengono gestiti gli errori restituiti nell'array di batch-load. Esamina i test esistenti per il caching e le risposte di errore, quindi verifica che l'opzione o la funzione di confronto proposta lasci non memorizzati nella cache gli errori selezionati, preservando il comportamento attuale per impostazione predefinita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

What problem are you trying to solve?

We have cases where we are using a dataloader on the server that utilizes server credentials to cache data that is used to resolve user requests (but not directly accessible to users). We refresh this cache everytime our server credentials are renewed (8 hrs). However, if we end up receiving a network error in those 8 hours, we cache that error as the response for a load.

Describe the solution you'd like

An option to not cache errors returned in the batch load return array. Or a comparison function that can evaluate whether to cache or not. (eg instanceof checks for certain error types)

Describe alternatives you've considered

Add additional code at all .load sites to clear the cache of these error values. This is onerous and prone to error
Monkeypatching the dataloader load function to clear the cache when an error is returned.

Additional context

This seems like it would be handy, but I also understand if it is an overspecific feature

Lingua principale
JavaScript
Stelle
13.4k
Fork
522
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di graphql/dataloader

Tutte le issue di graphql/dataloader

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.