List for cgit developers and users
 help / color / mirror / Atom feed
From: lfleischer at lfos.de (Lukas Fleischer)
Subject: RFC: don't cache objects larger than X
Date: Mon, 17 Oct 2016 19:56:17 +0200	[thread overview]
Message-ID: <147672697733.4027.221326930217641544@typhoon.lan> (raw)
In-Reply-To: <CAHmME9p9V=etf2VX7szyFegOFZb1Bc=G-m3K00e0pwoGs+Kjgw@mail.gmail.com>

On Wed, 12 Oct 2016 at 13:22:34, Jason A. Donenfeld wrote:
> I face this same problem, in fact. Unless somebody beats me to it, I'd
> be interested in giving this a stab.
> 
> One issue is that cache entries are currently "streamed" into the
> cache files, as they're produced. It's not trivially possible to know
> how big it's going to be beforehand. This means that the best we could
> do would be to just immediately unlink it after creation and printing.
> Would this be acceptable?

It is not easy to compute the exact size of the generated page but we
are able to detect huge objects before streaming -- the size of the
object is already returned by read_sha1_file().

I wonder whether the max-blob-size setting already does what you want,
though? It does not only affect the cached version but it seems better
to prevent from generating such huge pages in the first place. If you
really want to offer such files to your users, the max_blob_size check
in print_object() might be a good place to add the "print but do not
cache large files" functionality.

Regards,
Lukas


  parent reply	other threads:[~2016-10-17 17:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10 14:03 mricon
2016-10-12 11:22 ` Jason
2016-10-12 13:05   ` mricon
2016-10-17 17:56   ` lfleischer [this message]
2016-10-17 18:39     ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=147672697733.4027.221326930217641544@typhoon.lan \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).