{"action":"created","issue":{"url":"https://api.github.com/repos/MITLibraries/bento/issues/244","repository_url":"https://api.github.com/repos/MITLibraries/bento","labels_url":"https://api.github.com/repos/MITLibraries/bento/issues/244/labels{/name}","comments_url":"https://api.github.com/repos/MITLibraries/bento/issues/244/comments","events_url":"https://api.github.com/repos/MITLibraries/bento/issues/244/events","html_url":"https://github.com/MITLibraries/bento/pull/244","id":252029418,"number":244,"title":"Handle bad EDS Session Tokens","user":{"login":"JPrevost","id":1386650,"avatar_url":"https://avatars2.githubusercontent.com/u/1386650?v=4","gravatar_id":"","url":"https://api.github.com/users/JPrevost","html_url":"https://github.com/JPrevost","followers_url":"https://api.github.com/users/JPrevost/followers","following_url":"https://api.github.com/users/JPrevost/following{/other_user}","gists_url":"https://api.github.com/users/JPrevost/gists{/gist_id}","starred_url":"https://api.github.com/users/JPrevost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JPrevost/subscriptions","organizations_url":"https://api.github.com/users/JPrevost/orgs","repos_url":"https://api.github.com/users/JPrevost/repos","events_url":"https://api.github.com/users/JPrevost/events{/privacy}","received_events_url":"https://api.github.com/users/JPrevost/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-08-22T17:17:47Z","updated_at":"2017-08-23T19:08:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MITLibraries/bento/pulls/244","html_url":"https://github.com/MITLibraries/bento/pull/244","diff_url":"https://github.com/MITLibraries/bento/pull/244.diff","patch_url":"https://github.com/MITLibraries/bento/pull/244.patch"},"body":"## Status\r\n**READY**\r\n\r\n#### What does this PR do?\r\n\r\n* EDS sometimes does not accept session tokens they have created\r\n* detect and log when that happens\r\n* attempt to create a new session token, but only once, when detected\r\n  to hopefully provide end users with a reliable experience even when\r\n  our upstream source is being flakey\r\n* throw an exception if the bad token is detected on two consecutive attempts during a single  \r\n  request\r\n\r\n#### How can a reviewer manually see the effects of these changes?\r\n\r\nSadly, there is no great way without changing the code. However, this is how to change the code to see what should happen.\r\n\r\nIn `search_eds.rb` model, change line 70 from `return unless eds_session_invalid?(result)` to `return if @attempts == 1`. When running a local search, your logs should now show the detection of a bad token, a retry, and then your search should succeed (unless you somehow manage to do this at the same time as EDS is for real having problems in which case you'll get the exception message).\r\n\r\n#### What are the relevant tickets?\r\n- https://mitlibraries.atlassian.net/browse/DI-493\r\n\r\n#### Todo:\r\n- [x] Tests\r\n- [x] Documentation\r\n\r\n#### Requires Database Migrations?\r\nNO\r\n\r\n#### Includes new or updated dependencies?\r\nNO"},"comment":{"url":"https://api.github.com/repos/MITLibraries/bento/issues/comments/324433562","html_url":"https://github.com/MITLibraries/bento/pull/244#issuecomment-324433562","issue_url":"https://api.github.com/repos/MITLibraries/bento/issues/244","id":324433562,"user":{"login":"thatandromeda","id":959761,"avatar_url":"https://avatars2.githubusercontent.com/u/959761?v=4","gravatar_id":"","url":"https://api.github.com/users/thatandromeda","html_url":"https://github.com/thatandromeda","followers_url":"https://api.github.com/users/thatandromeda/followers","following_url":"https://api.github.com/users/thatandromeda/following{/other_user}","gists_url":"https://api.github.com/users/thatandromeda/gists{/gist_id}","starred_url":"https://api.github.com/users/thatandromeda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatandromeda/subscriptions","organizations_url":"https://api.github.com/users/thatandromeda/orgs","repos_url":"https://api.github.com/users/thatandromeda/repos","events_url":"https://api.github.com/users/thatandromeda/events{/privacy}","received_events_url":"https://api.github.com/users/thatandromeda/received_events","type":"User","site_admin":false},"created_at":"2017-08-23T19:08:46Z","updated_at":"2017-08-23T19:08:46Z","body":"OK, thanks for the thoughts. Looks like you will need to rebase but then merge away."}}
{"actor":{"display_login":"thatandromeda"}}