RequestServer: Delete unreadable cache files (for now)

If we are unable to pipe the response body from a cache file to the
client, let's take the extra safe approach of deleting the cache file
for now. We already remove the file if we weren't able to read its
metadata during initialization.
This commit is contained in:
Timothy Flynn 2025-10-15 12:56:00 -04:00 committed by Tim Flynn
parent 27cb5d8c1e
commit fc9233f198
Notes: github-actions[bot] 2025-10-16 13:08:01 +00:00

View file

@ -346,6 +346,10 @@ void CacheEntryReader::pipe_error(Error error)
{
dbgln("\033[31;1mError transferring cache to pipe for\033[0m {}: {}", m_url, error);
// FIXME: We may not want to actually remove the cache file for all errors. For now, let's assume the file is not
// useable at this point and remove it.
remove();
if (m_on_pipe_error)
m_on_pipe_error(m_bytes_piped);