JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Caching keys lack sub second precision
Nessuno ha ancora preso questa issue.
- Lingua principale
- Ruby
- Stelle
- 2.3k
- Fork
- 546
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
This issue is a (choose one):
- Problem/bug report.
- Feature request.
- Request for support. Note: Please try to avoid submitting issues for support requests. Use Gitter instead.
Checklist before submitting:
- I've searched for an existing issue.
- I've asked my question on Gitter and have not received a satisfactory answer.
- I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project.
- The feature I'm asking for is compliant with the JSON:API spec.
Description
Choose one section below and delete the other:
Bug reports:
The mechanism for building a cache key by default uses the rails updated_at field, which when stringified truncates the millisecond precision, which means that if two requests arrive and mutate a record in less than a second, the first write will win - which is the exact opposite of what you would want.
This is the monkey patched fix we've deployed
keys = cache_ids.map do |(id, cache_key)|
# If the cache key is a time object make it a high precision time object
if cache_key.is_a? Time
cache_key = cache_key.iso8601(4)
end
[type, id, cache_key, serializer_config_key, context_key]
end
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando il generatore predefinito delle cache key e la gestione dei valori updated_at di Rails. Esegui due mutazioni di un record a meno di un secondo di distanza, quindi verifica che le cache key risultanti mantengano la precisione al di sotto del secondo e che la regressione sia coperta da un test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rails, ruby
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100