{"action":"created","issue":{"url":"https://api.github.com/repos/edx/edx-platform/issues/12378","repository_url":"https://api.github.com/repos/edx/edx-platform","labels_url":"https://api.github.com/repos/edx/edx-platform/issues/12378/labels{/name}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/12378/comments","events_url":"https://api.github.com/repos/edx/edx-platform/issues/12378/events","html_url":"https://github.com/edx/edx-platform/pull/12378","id":153301294,"number":12378,"title":"A more considerate outer_atomic.","user":{"login":"symbolist","id":5305552,"avatar_url":"https://avatars.githubusercontent.com/u/5305552?v=3","gravatar_id":"","url":"https://api.github.com/users/symbolist","html_url":"https://github.com/symbolist","followers_url":"https://api.github.com/users/symbolist/followers","following_url":"https://api.github.com/users/symbolist/following{/other_user}","gists_url":"https://api.github.com/users/symbolist/gists{/gist_id}","starred_url":"https://api.github.com/users/symbolist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symbolist/subscriptions","organizations_url":"https://api.github.com/users/symbolist/orgs","repos_url":"https://api.github.com/users/symbolist/repos","events_url":"https://api.github.com/users/symbolist/events{/privacy}","received_events_url":"https://api.github.com/users/symbolist/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-05-05T19:07:18Z","updated_at":"2016-06-08T11:06:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/12378","html_url":"https://github.com/edx/edx-platform/pull/12378","diff_url":"https://github.com/edx/edx-platform/pull/12378.diff","patch_url":"https://github.com/edx/edx-platform/pull/12378.patch"},"body":"There are three use cases of `outer_atomic` in the code base.\r\n1. When we need to commit early before firing off tasks to celery. A much better solution for this is https://django-transaction-hooks.readthedocs.io/en/latest/ (which has been merged into Django 1.9).\r\n2. In cases where we want to commit the data no matter what happens latter. E.g. in the shopping cart or student verification related calls from third parties.\r\n3. To help prevent `IntegrityErrors`. \r\n\r\nThe current version of `outer_atomic` is absolute: it expects all callers to not be in a transaction. However, in case 3, we do not need this constraint for all callers since only some specific views are going to be the cause of the `IntegrityErrors`. This PR adds an option to name an `outer_atomic` instance. Then views which are causing the `IntegrityErrors` can use the `enable_outer_atomic(name=<name>)` decorator to have the constraint forced. All other callers can work without needing any changes."},"comment":{"url":"https://api.github.com/repos/edx/edx-platform/issues/comments/224558110","html_url":"https://github.com/edx/edx-platform/pull/12378#issuecomment-224558110","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/12378","id":224558110,"user":{"login":"muhammad-ammar","id":6767924,"avatar_url":"https://avatars.githubusercontent.com/u/6767924?v=3","gravatar_id":"","url":"https://api.github.com/users/muhammad-ammar","html_url":"https://github.com/muhammad-ammar","followers_url":"https://api.github.com/users/muhammad-ammar/followers","following_url":"https://api.github.com/users/muhammad-ammar/following{/other_user}","gists_url":"https://api.github.com/users/muhammad-ammar/gists{/gist_id}","starred_url":"https://api.github.com/users/muhammad-ammar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muhammad-ammar/subscriptions","organizations_url":"https://api.github.com/users/muhammad-ammar/orgs","repos_url":"https://api.github.com/users/muhammad-ammar/repos","events_url":"https://api.github.com/users/muhammad-ammar/events{/privacy}","received_events_url":"https://api.github.com/users/muhammad-ammar/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T11:06:58Z","updated_at":"2016-06-08T11:06:58Z","body":"@doctoryes @adampalay This is ready for review."}}
{"actor":{"display_login":"muhammad-ammar"}}