unexpected cache issue when http errors

John Keeping john at keeping.me.uk
Tue Mar 31 20:39:19 CEST 2015


On Mon, Mar 30, 2015 at 07:15:27PM +0200, Nicolas Dely wrote:
> I would like to share an unexpected cache behaviour with this list and 
> discuss about a solution.
> 
> Indeed we are using cgit to provide a web interface to our internal user 
> and also to provide file to our reviewboard server.
> 
> We are experiencing some cache issue on static pages when data are not 
> pushed yet to server but reviewboard tries to access these 
> files/repositories. Cache is adding even 404, 401 or 500 error for 
> static page, we can workaround this issue after reducing/setting static 
> cache issue but it looks not very useful to cache http errors.
> 
> Do you think it is possible to only cache when HTTP is 200 OK? Other ideas?

I don't think it will be easy to change the behaviour to cache only on
200 responses, and I'm not sure it's desirable to do so since the
process of determining that a result is an error may involve significant
work (e.g. loading packed refs or pack indexes).

I can see an argument for changing the default for "cache-static-ttl" to
a positive value, so that if we do cache an error result it will
eventually time out without needing another page to be written into that
cache slot, but I'm not sure I understand how you reviewboard server can
access files that have not yet been pushed to the Git server.  If you're
reviewing committed changes, shouldn't the review be posted by a hook on
the server, which would ensure that the commits are available before
reviewboard knows about them?


More information about the CGit mailing list