Re: lasttime not always last word

amb-Uxr6IM1mbv2TY6FTCsQk+9Bc4/[email protected] (Andrew M. Bishop) 30 Aug 2006 19:19:01 +0100
Newsgroups gmane.network.wwwoffle.user
Message-ID <[email protected]>
Dan Jacobson <[email protected]> writes:

> Shocked that lasttime didn't have my million byte download,
> $ wwwoffle-ls lasttime|grep http://example.com/bla
> Dl7E74frPxocV7qzzUndJgg     960 Aug 18  5:58 http://example.com/bla
> I did in fact find it,
> $ wwwoffle-ls http://example.com/bla
> Dl7E74frPxocV7qzzUndJgg 2377140 Aug 18  6:16 http://example.com/bla
> It turns out if one makes several download attempts, only the first
> one is in lasttime. One must check with
> $ find /var/cache/wwwoffle/lasttime/ -name U\* ! -links 2|xargs sed :; echo
> http://example.com/bla
> http://nurd.turd/bla
> for such cases.  I'd say it is a bug.

There is a reason for this behaviour but I can see a way to make both
features work.

Currently the file in the lasttime directory is created when we start
downloading a web page and the file doesn't already exist.  If it does
exist then we set a flag.  When we get the header for the page it
might be a '302 page unchanged' header, in this case we delete the
file in the lasttime directory if the flag was set previously.

This means that if you try and fetch the page just once in a session
and it has not changed since the previous session (or earlier) then
there is no file in the lasttime directory.  If you fetch the page
again and it has not changed since earlier in the same session then
the page is left in the lasttime directory.

The solution is to perform the same check about the file already
existing, then to delete it and create the new link.  This makes sure
that the link is always to the latest real cached file, but the
previous behaviour is preserved.  (This also requires that the link is
recreated again when the backup is restored if the page has not
changed).

This will be in the next version.

-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             amb-Uxr6IM1mbv2TY6FTCsQk+9Bc4/[email protected]
                                      http://www.gedanken.demon.co.uk/

WWWOFFLE users page:
        http://www.gedanken.demon.co.uk/wwwoffle/version-2.9/user.html