{"action":"opened","issue":{"url":"https://api.github.com/repos/paulcbetts/Fusillade/issues/11","labels_url":"https://api.github.com/repos/paulcbetts/Fusillade/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/paulcbetts/Fusillade/issues/11/comments","events_url":"https://api.github.com/repos/paulcbetts/Fusillade/issues/11/events","html_url":"https://github.com/paulcbetts/Fusillade/issues/11","id":90055800,"number":11,"title":"A message handler for authentication","user":{"login":"promontis","id":374646,"avatar_url":"https://avatars.githubusercontent.com/u/374646?v=3","gravatar_id":"","url":"https://api.github.com/users/promontis","html_url":"https://github.com/promontis","followers_url":"https://api.github.com/users/promontis/followers","following_url":"https://api.github.com/users/promontis/following{/other_user}","gists_url":"https://api.github.com/users/promontis/gists{/gist_id}","starred_url":"https://api.github.com/users/promontis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promontis/subscriptions","organizations_url":"https://api.github.com/users/promontis/orgs","repos_url":"https://api.github.com/users/promontis/repos","events_url":"https://api.github.com/users/promontis/events{/privacy}","received_events_url":"https://api.github.com/users/promontis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-22T09:44:30Z","updated_at":"2015-06-22T09:44:30Z","closed_at":null,"body":"Hi Paul! \r\n\r\nI'm currently working on a project where I authenticate every api call using OAuth2/OpenId. To use this within the Fusillade stack, I've created a message handler which will do the api request, and if the request fails because the token has expired (unauthorized response), I'll post a new request to refresh the token, and re-post the original api request. \r\n\r\nNow I would like optimize it. Currently, some of my views are making calls to my api in a concurrent way, all with a different priority. From what I see, there are at least 3 concurrent api requests at one time. Now when the token has expired, each of those concurrent api request will fail and all of them will refresh the token. I'd like only one request to refresh the token and pass its result to the other two. After the token has been refreshed, all concurrent requests should execute again.\r\n\r\nHow would you implement such a message handler?\r\n\r\n\r\n\r\n"}}