Interactions between Lolex, Timecop and the Cache in HyperSpec
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Empieza por localizar los métodos cache_read, cache_write y cache_delete de HyperSpec::Internal::Controller; después, inspecciona Lolex.evaluate_ruby y cómo interactúan allí Filecache y Timecop. Se considera completado cuando las operaciones de caché utilizan la hora del sistema y las actualizaciones de Lolex se conservan cuando HyperSpec no está montado, sin enviar comunicación innecesaria al cliente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hyperspec uses the Filecache gem, which uses Time.now. But if Timecop freezes time in a spec, then Time.now is not returning the system time, and the Filecache does not work. This should be fixable by wrapping calls to the Filecache with the timecop return method (and a block.) But this does not in general work because Hyperspec tries to communicate the "return" to the client, even if the client is not running.
The following series of patches fixes the issue, and can be incorporated into the next point release:
module HyperSpec
module Internal
module Controller
class << self
# wrap all calls with Timecop.return so the file cache gets the true system time
def cache_read(key)
Timecop.return { file_cache.get(key) }
end
def cache_write(key, value)
Timecop.return { file_cache.set(key, value) }
end
def cache_delete(key)
Timecop.return { file_cache.delete(key) }
rescue StandardError
nil
end
end
end
end
end
class Lolex
# store all lolex updates unless hyper_spec is mounted
def self.evaluate_ruby(&block)
if @capybara_page&.instance_variable_get('@hyper_spec_mounted')
@capybara_page.internal_evaluate_ruby(yield)
else
pending_evaluations << block
end
end
end
- Lenguaje dominante
- JavaScript
- Estrellas
- 538
- Forks
- 41
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de hyperstack-org/hyperstack
-
expose_as_operations method Abiertoenhancement needs doc
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
hyperstack-org/hyperstack#359 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
hyperstack-org/hyperstack#267 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
hyperstack-org/hyperstack#457 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
hyperstack-org/hyperstack#456 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
hyperstack-org/hyperstack#455 · 2 comentarios ·
Todos los issues de hyperstack-org/hyperstack
Issues similares
-
ai-observability bug team/ai-observability
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
AllTheMods/ATM-10-L#19 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
SignalK/n2k-signalk#345 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
JuliaPluto/PlutoPlotly.jl#72 ·