Calling offpunk fakedomain.foo
creates a cache entry at ~/.cache/offpunk/gemini/fakedomain.foo/index.gmi
with the following contents:
2022-11-24 16:44:31.224119
ERROR while caching gemini://fakedomain.foo/
*****
<class 'socket.gaierror'> = [Errno -2] Name or service not known
*****
If you believe this error was temporary, type reload.
The ressource will be tentatively fetched during next sync.
As a user experience it's probably better to not store anything if visiting a URL failed.
Why do you consider it as a bug?
I agree that it is not perfect and I’ve considered having a .cache/offpunk/error folder which would be a mirror of the other cache but for error only.
I plan to do a major rewrite of offpunk to completely separate the network/caching from everything else and I may change the behaviour at that point. I don’t consider it an urgent problem as "it works for me" (feel free to convince me of the opposite)
Oh I definitely don't consider it an urgent issue. Just posted it as something to consider in the future. Having a separate error cache sounds like a good idea.
Wondering if any effort should be made to put this into offpunk 2.0.
Current code separation may make it quite easier as it implies modifying only netcache to do the following:
- Function set_error should write in its own folder, not in the cache anymore
- cache_last_modified() should return the most recent modification time from either the real cache or error cache
But I realize writing this that there’s a catch. What happens if there’s an error and no cached version ?
If we consider this as a valid cache, offpunk will try to retrieve it through get_cache_path and there’s nothing there! If we consider it as an invalid cache, offpunk will try again and again to redownload it.
Also, what if we have an older, valid cache but an error to refresh? How do we display that?