mezis/yarp — pull request #4 by dawid-sklodowski (2013-09-27 17:32:14+00:00)
Title: Tech doctors/be faster on cache misses 57378292

https://github.com/mezis/yarp/issues/1 :

> When a request is made for something that's not in the cache, we currently synchronously fetch from upstream, and return the results.
>
> It would be faster, in this case, to redirect to upstream asynchronously (through DJ for instance) prime the cache.
> This is faster for the client on 1st request ; the drawback (which is not our concern) is 2 identical requests made to upstream.

Implementation:
When user hits yarp and there is no entry in cache, then user is redirected to rubygems and thread is being spawned by yarp to fetch required file from ruby gems. Also there is mechanism which prevents spawning new thread to download file that is already being downloaded by other thread.