Skip to content

GH caching issue #2088

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

GH caching issue #2088

wants to merge 1 commit into from

Conversation

apiraino
Copy link
Contributor

@apiraino apiraino commented Jun 23, 2025

@ehuss do you have thoughts about this approach?

(without looking too much at the messy code)

src/config.rs Outdated
Comment on lines 540 to 548
let mut content_items = octocrab::instance()
.repos(repo.owner(), repo.name())
.get_content()
.path(CONFIG_FILE_NAME)
.r#ref(&repo.default_branch)
.send()
.await
.map_err(|e| ConfigurationError::Http(Arc::new(e.into())))?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Getting the file using the git API reduces the caching time but not completely. It looks like this way it's much shorter. Empirically (looking with RUST_LOG=trace) a couple of seconds, just until the connection is closed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC this basically creates everytime a new HTTP client, not great, but this codepath is run just once at the start of triagebot and everytime the triagebot.toml of the rust repository is updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know yet what to think of REFRESH_EVERY_SECS.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can just pass the existing Context::octocrab instance to the get function to avoid creating a new client. Otherwise this looks fine. I guess that REFRESH_EVERY_SECS should work exactly the same as before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did some more tests: my solution is not reliable, GH cache is just really sticky and I can't figure out a way around it. Certainly I can't have the pretension to outsmart them. I will leave this code here as a memento in case someone wants to try 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants