Skip to content

print current rust version on the about page #272

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

Merged
merged 1 commit into from
Dec 19, 2018

Conversation

QuietMisdreavus
Copy link
Member

Closes #257

Now that we're using a real nightly compiler to build docs, let's show the version somewhere. This PR takes the suggestion from the linked issue and prints the version of the rustc inside the container on the "about" page.

Open question: Would it be better to cache this version string somewhere (say, in the database or in some lazy_static) so we don't have to attach to the container and run rustc --version every time someone loads the About page?

@QuietMisdreavus
Copy link
Member Author

Output on my personal test server (which is using an older rustc than production, but the same principle should apply):

image

@dekellum
Copy link

dekellum commented Dec 5, 2018

LGTM, thanks!

@onur
Copy link
Member

onur commented Dec 17, 2018

Like you said in your comment, problem with this approach is its running rustc (and lxc-attach etc.) every time when someone visits about page. I think its much better to cache rustc version. We can store it in our config table in database (it's a simple table with key and value members designed for this kind of things), and since we are running cratesfyi build add-essential-files every time when we update rustc, we can use this function to update value in database.

@QuietMisdreavus
Copy link
Member Author

I've updated the PR to use the config table like you suggested. Loading it during add-essential-files is perfect. I've tested it on my dev server and it works great.

pub fn about_handler(_: &mut Request) -> IronResult<Response> {
let mut content = BTreeMap::new();

let conn = ctry!(connect_db());
Copy link
Member

@onur onur Dec 19, 2018

Choose a reason for hiding this comment

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

We are using our r2d2 connection pool in our iron handlers. Instead of creating a new connection, getting req parameter and using let conn = extension!(req, Pool); should do the trick (similar to sitemap_handler).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! I've force-pushed an update with this change.

@onur onur merged commit 35eaf74 into rust-lang:master Dec 19, 2018
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.

3 participants