Merge lp:~gary/launchpad/bug844631 into lp:launchpad
|Approved by:||Gary Poster on 2011-10-03|
|Merged at revision:||14096|
|Diff against target:||
790 lines (+482/-61)
9 files modified
|To merge this branch:||bzr merge lp:~gary/launchpad/bug844631|
|Related bugs and blueprints:||
[r=bac,lifeless][bug=844631] Add an error page for when the database is down (such as fastdowntime) or has serious issues.
Description of the Change
= Overview =
This branch adds an error page for when the database is down (such as fastdowntime) or has serious issues.
It catches both OperationalError and DisconnectionError because, on experimentation, it seems that the database raises OperationalError if it can't connect initially (such as after an app restart when the db is down), and (as expected) DisconnectionError if it was connected but lost the connection.
= UI =
The page design is by Huw, except for the status update section, which I had to rewrite because of technical reasons (see below).
= Implementation =
The registration of the page is straightforward. The branch only has two elements of real interest (and which took up my time).
== Testing ==
The first exciting bit was testing. Stuart suggested that I write integration tests using pgbouncer. This was a bit challenging because it found some edge cases in using the pgbouncer. In particular, you'll see an odd little loop in the test where I get rid of two 500 errors. This was about the best I could do. I talked with him about this for some time and had some alternatives, but we settled on this. I'm not sure what to tell you about it, even though it took a longer time than expected.
== Status updates ==
The second element of this branch that took up my time is the inclusion of the status updates on the page.
=== Rejected ideas ===
(Feel free to skip; I feel compelled to share.)
Huw initially had done this with a Twitter-supplied widget that had a number of problems, such as relying on http. He found another widget, but it relied on jsonp, which would introduce a security hole for our site (http://
=== Implementation: the story ===
(OK, you can skip this too. This took so long that I feel like talking about it, I guess.)
I next explored the Flash xdr method that YUI provides. Identi.ca does not provide a http://
Unfortunately, it used Flash.
Next, I discovered CORS (http://
=== Implementation: the meat ===
(Read this part, please.)
I try CORS first. That should work on modern Ubuntu installs. If that fails, I fall back to Flash. If that fails, I give up. This seems to work. Yay.
=== Testing the JS out yourself ===
You probably could just shut down PG while you run LP, but I installed a temporary view to look at it.
=== modified file 'lib/lp/
@@ -377,6 +377,15 @@
+ <!-- XXX Remove -->
== Lint ==
lint is happy AFAICT except for the usual long line complaints in the lazr config file, but "make lint" is confused and gives me lint on the whole tree, so it's possible I missed something.
- 13979. By Gary Poster on 2011-09-30
reinstate publication.py changes per review
- 13980. By Gary Poster on 2011-09-30
hide JS-populated bits from JS browsers
- 13981. By Gary Poster on 2011-10-02
fix test failures
- 13982. By Gary Poster on 2011-10-03
address test failures
- 13983. By Gary Poster on 2011-10-03
reinstate branch, with fixes.