{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/support/issues/273","repository_url":"https://api.github.com/repos/alphagov/support","labels_url":"https://api.github.com/repos/alphagov/support/issues/273/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/support/issues/273/comments","events_url":"https://api.github.com/repos/alphagov/support/issues/273/events","html_url":"https://github.com/alphagov/support/pull/273","id":140745325,"number":273,"title":"Prevent duplicate Zendesk ticket creation","user":{"login":"binaryberry","id":8225167,"avatar_url":"https://avatars.githubusercontent.com/u/8225167?v=3","gravatar_id":"","url":"https://api.github.com/users/binaryberry","html_url":"https://github.com/binaryberry","followers_url":"https://api.github.com/users/binaryberry/followers","following_url":"https://api.github.com/users/binaryberry/following{/other_user}","gists_url":"https://api.github.com/users/binaryberry/gists{/gist_id}","starred_url":"https://api.github.com/users/binaryberry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binaryberry/subscriptions","organizations_url":"https://api.github.com/users/binaryberry/orgs","repos_url":"https://api.github.com/users/binaryberry/repos","events_url":"https://api.github.com/users/binaryberry/events{/privacy}","received_events_url":"https://api.github.com/users/binaryberry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-14T17:43:28Z","updated_at":"2016-03-15T09:51:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/alphagov/support/pulls/273","html_url":"https://github.com/alphagov/support/pull/273","diff_url":"https://github.com/alphagov/support/pull/273.diff","patch_url":"https://github.com/alphagov/support/pull/273.patch"},"body":"When receiving a 409 response (conflict) from the Zendesk API, the support app keeps trying to create a ticket until the request goes through. \r\n\r\nThis change rescues the 409 response and takes no action, ignoring the ticket creation because Zendesk has already received it. \r\n\r\nThis PR also desactivates the submit button in the view after it has been pressed, to prevent duplicate requests being generated in the frontend (the below would usually be displayed for less than a second).\r\n\r\n![screen shot 2016-03-14 at 17 52 34](https://cloud.githubusercontent.com/assets/8225167/13754079/972b9c6c-ea0d-11e5-899d-7999d4992237.png)\r\n\r\nAnother change that was considered was to store a hash of the ticket requester/contents for a few minutes in an ephemeral cache (eg redis) and drop any duplicates - however we think the two changes above are enough to solve the problem (do jump in @benilovj if you disagree).\r\n\r\n[Trello ticket](https://trello.com/c/dnYu5sNT/312-fix-zendesk-duplicate-ticket-issue-medium)"},"comment":{"url":"https://api.github.com/repos/alphagov/support/issues/comments/196745913","html_url":"https://github.com/alphagov/support/pull/273#issuecomment-196745913","issue_url":"https://api.github.com/repos/alphagov/support/issues/273","id":196745913,"user":{"login":"benilovj","id":23801,"avatar_url":"https://avatars.githubusercontent.com/u/23801?v=3","gravatar_id":"","url":"https://api.github.com/users/benilovj","html_url":"https://github.com/benilovj","followers_url":"https://api.github.com/users/benilovj/followers","following_url":"https://api.github.com/users/benilovj/following{/other_user}","gists_url":"https://api.github.com/users/benilovj/gists{/gist_id}","starred_url":"https://api.github.com/users/benilovj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benilovj/subscriptions","organizations_url":"https://api.github.com/users/benilovj/orgs","repos_url":"https://api.github.com/users/benilovj/repos","events_url":"https://api.github.com/users/benilovj/events{/privacy}","received_events_url":"https://api.github.com/users/benilovj/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T09:51:53Z","updated_at":"2016-03-15T09:51:53Z","body":"I don't think that the duplicate submission protection on the government support request forms will help here. Almost all of the duplicates originate through the [public support form](https://www.gov.uk/contact/govuk), which go through the `feedback` app. I'm not sure we'd see any benefit from having the protection there, given the low occurrence of government support request duplicate tickets.\r\n\r\nOn the broader question of \"is discarding the 409 response enough?\", my previous analysis suggested that it may not be enough, but we cannot be sure until we make this change. I'd suggest that we come back in a month after releasing this change and see how many duplicates there are now, and decide whether further duplicate detection is necessary. ^ @boffbowsh "}}