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

Backend: cache events and contributor listings #1051

Merged
merged 1 commit into from
Sep 9, 2015

Conversation

harding
Copy link
Contributor

@harding harding commented Sep 6, 2015

When making changes to the site, Saïvann and I often diff the resulting HTML output with output from earlier known-good commits. One problem with this method is that the HTML output isn't fully deterministic---some of it comes from external sites and can change massively between two builds that are only minutes apart, making reading the diff unpleasant and less useful than it could be.

This commit caches that external data between builds so that two builds on the same computer are very nearly deterministic. As evidence, at the end of this message I offer inline the full diff of two sequential builds both on this commit.

Cached Meetup.com events, Bitcoin Core contributor listings, and Bitcoin.org contributor listings are retained for 24 hours before being refreshed. Cached Geo-location data for conferences is retained until the _events.yml file is updated. Caches are updated based on file timestamps, so they can be manipulated using touch or simply deleted to fetch new data.

This commit includes one small miscellaneous change to the Makefile to reduce the size of the /commit.txt file. (The replaced command didn't work the way I thought it did; this command produces the correct output.)

diff -ru _site_a/en/rss/blog.xml _site/en/rss/blog.xml
--- _site_a/en/rss/blog.xml 2015-09-06 18:52:46.785203305 -0400
+++ _site/en/rss/blog.xml   2015-09-06 19:07:01.027678049 -0400
@@ -5,8 +5,8 @@
     <description>News about Bitcoin.org</description>
     <link>//</link>
     <atom:link href="//en/rss/blog.xml" rel="self" type="application/rss+xml"/>
-    <pubDate>Sun, 06 Sep 2015 18:45:28 -0400</pubDate>
-    <lastBuildDate>Sun, 06 Sep 2015 18:45:28 -0400</lastBuildDate>
+    <pubDate>Sun, 06 Sep 2015 18:59:39 -0400</pubDate>
+    <lastBuildDate>Sun, 06 Sep 2015 18:59:39 -0400</lastBuildDate>
     <generator>Jekyll v1.3.0</generator>

       <item>
diff -ru _site_a/sha256sums.txt _site/sha256sums.txt
--- _site_a/sha256sums.txt  2015-09-06 18:52:47.465211621 -0400
+++ _site/sha256sums.txt    2015-09-06 19:07:01.727686654 -0400
@@ -325,7 +325,7 @@
 34e1e82c7810f261baec99a73c0327c0a05a46d2869ed57840130daf5ea5fddd  _site/en/release/v0.9.3.html
 63b90f09f0def9780a9da8eeef0e4430e147b156314a0a1931ef17afa38920a5  _site/en/resources.html
 ea62e46ad3c8fc96824074ba21abc9bad9df2b145d2b230ae84a69b0d5ca8035  _site/en/rss/alerts.rss
-9f772391bb916ebd273d5e9d03d4d45b87f3d4f0a3440effc0537c10163f47d5  _site/en/rss/blog.xml
+4b6f77955753228f295068092928b87db7ea43a87c71b7f767c1ee7e2106ff7a  _site/en/rss/blog.xml
 49f3438da26309fc3c20522dae6cab65efb3c502327df6693933239fc53fe1c2  _site/en/rss/releases.rss
 d2b7db6b8bada8f96aeb505e0b284a28b83fda625c91aac48684dfde73cfd35e  _site/en/secure-your-wallet.html
 5e77e94a36c5698486b0d1fc383a7a7f874131d5be0b38973d6548758c89ba5c  _site/en/support-bitcoin.html

site.corecontributors = contributors('bitcoin/bitcoin',site.config['aliases'])
site.sitecontributors = contributors('bitcoin-dot-org/bitcoin.org',site.config['aliases'])
## Create cache directory if it doesn't exist
system 'mkdir', '-p', '_cache'
Copy link
Contributor

Choose a reason for hiding this comment

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

@harding How about the ruby equivalent Dir.mkdir('_cache') if !File.exists?('_cache')
(This line of code also occurs elsewhere)

@ghost1542
Copy link
Contributor

That solution is also elegant in that it prevents repeated API calls by default when testing! And probably improve performances quite a bit at the same time.

Thanks, LGTM 15bb63b!

@harding
Copy link
Contributor Author

harding commented Sep 7, 2015

@saivann amended commit to use the Ruby mkdir (didn't know about that, thanks!). Thanks for reviewing!

In the absence of critical feedback, this will be merged on Wednesday.

harding added a commit to harding/bitcoin.org that referenced this pull request Sep 9, 2015
- 1048: Conditionally build some pages differently based on environmental variables
- 1051: Backend: cache events and contributor listings
@harding harding merged commit b3f4ba5 into bitcoin-dot-org:master Sep 9, 2015
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