{"action":"created","issue":{"url":"https://api.github.com/repos/hypothesis/h/issues/2916","repository_url":"https://api.github.com/repos/hypothesis/h","labels_url":"https://api.github.com/repos/hypothesis/h/issues/2916/labels{/name}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/2916/comments","events_url":"https://api.github.com/repos/hypothesis/h/issues/2916/events","html_url":"https://github.com/hypothesis/h/pull/2916","id":131423155,"number":2916,"title":"Add automated retry with backoff for session loads","user":{"login":"robertknight","id":2458,"avatar_url":"https://avatars.githubusercontent.com/u/2458?v=3","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-04T17:48:54Z","updated_at":"2016-02-08T14:19:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/2916","html_url":"https://github.com/hypothesis/h/pull/2916","diff_url":"https://github.com/hypothesis/h/pull/2916.diff","patch_url":"https://github.com/hypothesis/h/pull/2916.patch"},"body":"If a session load fails, subsequent calls to\r\nsession.load() would trigger another request immediately.\r\nTogether with feature flag checks triggering session.load(),\r\nthis could result in a cycle if no network connection was present:\r\n\r\n 1. App loads during initial digest cycle, 'flag.featureEnabled()'\r\n    is called to test whether to show certain UI elements\r\n 2. session.load() is triggered\r\n 3. session.load() fails and the HTTP response error triggers\r\n    a digest cycle\r\n 4. GOTO 1\r\n\r\nThis commit resolves the problem by automatically retrying\r\nsession.load() calls with an exponential backoff.\r\n\r\nA side _benefit_ of this is that if you activate the Chrome extension when you have no\r\nnetwork connectivity, the app will defer loading until the network becomes available.\r\nPreviously if the `/app` request failed, the sidebar loaded but displayed in the default logged-out state.\r\n\r\nA downside is that no error indication is currently shown to indicate why the app remains in a loading state."},"comment":{"url":"https://api.github.com/repos/hypothesis/h/issues/comments/181392813","html_url":"https://github.com/hypothesis/h/pull/2916#issuecomment-181392813","issue_url":"https://api.github.com/repos/hypothesis/h/issues/2916","id":181392813,"user":{"login":"nickstenning","id":3602,"avatar_url":"https://avatars.githubusercontent.com/u/3602?v=3","gravatar_id":"","url":"https://api.github.com/users/nickstenning","html_url":"https://github.com/nickstenning","followers_url":"https://api.github.com/users/nickstenning/followers","following_url":"https://api.github.com/users/nickstenning/following{/other_user}","gists_url":"https://api.github.com/users/nickstenning/gists{/gist_id}","starred_url":"https://api.github.com/users/nickstenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickstenning/subscriptions","organizations_url":"https://api.github.com/users/nickstenning/orgs","repos_url":"https://api.github.com/users/nickstenning/repos","events_url":"https://api.github.com/users/nickstenning/events{/privacy}","received_events_url":"https://api.github.com/users/nickstenning/received_events","type":"User","site_admin":false},"created_at":"2016-02-08T14:19:37Z","updated_at":"2016-02-08T14:19:37Z","body":"LGTM."}}