Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update local metadata lookup cache more often #28067

Merged
merged 1 commit into from
May 3, 2024

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented May 2, 2024

RFC. As proposed in #27332 (comment).

Refresh interval chosen is 1 month - seems like a decent compromise to me?

Testing was mostly manual here because automated is gonna be very awkward here. Some faffing about was done with touch and dd to simulate various fun things.

  • Probably needs testing on windows because windows has funky/different file semantics (can't do it now, I have sheets calculating in the background, will do later)

Comment on lines +178 to +182
// ensure to clobber any and all existing data to avoid accidental corruption.
outStream.SetLength(0);

using (var bz2 = new BZip2Stream(stream, CompressionMode.Decompress, false))
bz2.CopyTo(outStream);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably going to be the most contentious here (attempting to replace the cache file in situ). I did it this way because it seemed simpler. I guess I could try writing to yet another file and doing a file swapsie instead at the end but that seemed like it'd be much more complicated for very little gain because IO can and will go wrong anywhere and always...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm up for trying this, it's not conventionally how I'd do it but I'm interested to see how it plays out.

Seems to work well on macOS.

@bdach
Copy link
Collaborator Author

bdach commented May 3, 2024

Checked windows, seems to behave fine.

@peppy peppy self-requested a review May 3, 2024 09:27
@peppy peppy merged commit 6cec4f0 into ppy:master May 3, 2024
15 of 17 checks passed
@bdach bdach deleted the refresh-local-cache-more-often branch May 3, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants