all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Caching calls to download-to-store?
@ 2024-11-27 20:21 Ricardo Wurmus
  2024-11-28  8:33 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2024-11-27 20:21 UTC (permalink / raw)
  To: guix-devel

Hi Guix,

the CRAN updater downloads every upstream archive three times.  The
importer memoizes calls to the download procedure, but one download that
is out of reach is the very first.

It is triggered by package-update/url-fetch in (guix upstream).  It uses
download-to-store, which will unconditionally fetch whatever URL it is
given.

I would very much like to parameterize download-to-store, so that we can
optionally cache the results of its invocation.

What do you think?

-- 
Ricardo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Caching calls to download-to-store?
  2024-11-27 20:21 Caching calls to download-to-store? Ricardo Wurmus
@ 2024-11-28  8:33 ` Ludovic Courtès
  2024-11-28 10:21   ` Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2024-11-28  8:33 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hi,

Ricardo Wurmus <rekado@elephly.net> skribis:

> the CRAN updater downloads every upstream archive three times.  The
> importer memoizes calls to the download procedure, but one download that
> is out of reach is the very first.
>
> It is triggered by package-update/url-fetch in (guix upstream).  It uses
> download-to-store, which will unconditionally fetch whatever URL it is
> given.

Why three times (and not two)?

> I would very much like to parameterize download-to-store, so that we can
> optionally cache the results of its invocation.

I’m not sure exactly how to do that, but why not.

Another option would be to register GC roots (or mere symlinks) in
~/.cache for things that are downloaded, and then to use
‘If-Modified-Since’ plus some default TTL to determine whether to
re-download things.

HTH,
Ludo’.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Caching calls to download-to-store?
  2024-11-28  8:33 ` Ludovic Courtès
@ 2024-11-28 10:21   ` Ricardo Wurmus
  2024-11-29 15:31     ` Simon Tournier
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2024-11-28 10:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> the CRAN updater downloads every upstream archive three times.  The
>> importer memoizes calls to the download procedure, but one download that
>> is out of reach is the very first.
>>
>> It is triggered by package-update/url-fetch in (guix upstream).  It uses
>> download-to-store, which will unconditionally fetch whatever URL it is
>> given.
>
> Why three times (and not two)?

Not entirely sure, but it's tracked here

   https://issues.guix.gnu.org/48792
   https://issues.guix.gnu.org/44256

I'm already caching some downloads in the updater, but it's not always
working as intended.  (I have an unfinished fix for this locally.)

>> I would very much like to parameterize download-to-store, so that we can
>> optionally cache the results of its invocation.
>
> I’m not sure exactly how to do that, but why not.
>
> Another option would be to register GC roots (or mere symlinks) in
> ~/.cache for things that are downloaded, and then to use
> ‘If-Modified-Since’ plus some default TTL to determine whether to
> re-download things.

That's a good idea.  Currently, we download to arbitrary temporary
directories.  The downloads performed by importers vanish immediately.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Caching calls to download-to-store?
  2024-11-28 10:21   ` Ricardo Wurmus
@ 2024-11-29 15:31     ` Simon Tournier
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Tournier @ 2024-11-29 15:31 UTC (permalink / raw)
  To: Ricardo Wurmus, Ludovic Courtès; +Cc: guix-devel

Hi,

On Thu, 28 Nov 2024 at 11:21, Ricardo Wurmus <rekado@elephly.net> wrote:

>> Why three times (and not two)?

Yeah three times, weird.

> Not entirely sure, but it's tracked here
>
>    https://issues.guix.gnu.org/48792
>    https://issues.guix.gnu.org/44256
>
> I'm already caching some downloads in the updater, but it's not always
> working as intended.  (I have an unfinished fix for this locally.)

Ah cool!

>>> I would very much like to parameterize download-to-store, so that we can
>>> optionally cache the results of its invocation.
>>
>> I’m not sure exactly how to do that, but why not.
>>
>> Another option would be to register GC roots (or mere symlinks) in
>> ~/.cache for things that are downloaded, and then to use
>> ‘If-Modified-Since’ plus some default TTL to determine whether to
>> re-download things.
>
> That's a good idea.  Currently, we download to arbitrary temporary
> directories.  The downloads performed by importers vanish immediately.

If we populate some ~/.cache/guix then what would trigger the clean up
of such cache?

Cheers,
simon


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-29 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-27 20:21 Caching calls to download-to-store? Ricardo Wurmus
2024-11-28  8:33 ` Ludovic Courtès
2024-11-28 10:21   ` Ricardo Wurmus
2024-11-29 15:31     ` Simon Tournier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.