{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/social/pulls/comments/83187987","pull_request_review_id":4045512,"id":83187987,"diff_hunk":"@@ -287,20 +272,21 @@ def _concurrent_events(self, event_type, metadata):\n \n     @api.multi\n     def event_create(self, event_type, metadata):\n+        testing = getattr(threading.currentThread(), 'testing', False)\n         event_ids = self.env['mail.tracking.event']\n         for tracking_email in self:\n             other_ids = tracking_email._concurrent_events(event_type, metadata)\n             if not other_ids:\n                 vals = tracking_email._event_prepare(event_type, metadata)\n                 if vals:\n                     event_ids += event_ids.sudo().create(vals)\n-                partners = self.tracking_ids_recalculate(\n-                    'res.partner', 'email', 'tracking_email_ids',\n-                    tracking_email.recipient_address)\n-                if partners:\n-                    partners.email_score_calculate()\n+                    # Commit to DB to release exclusive lock\n+                    if not testing:\n+                        self.env.cr.commit()  # pragma: no cover","path":"mail_tracking/models/mail_tracking_email.py","position":206,"original_position":206,"commit_id":"2afe69c958d72c49027e603d2b563d316ea9eb86","original_commit_id":"2afe69c958d72c49027e603d2b563d316ea9eb86","user":{"login":"lasley","id":7397578,"avatar_url":"https://avatars.githubusercontent.com/u/7397578?v=3","gravatar_id":"","url":"https://api.github.com/users/lasley","html_url":"https://github.com/lasley","followers_url":"https://api.github.com/users/lasley/followers","following_url":"https://api.github.com/users/lasley/following{/other_user}","gists_url":"https://api.github.com/users/lasley/gists{/gist_id}","starred_url":"https://api.github.com/users/lasley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lasley/subscriptions","organizations_url":"https://api.github.com/users/lasley/orgs","repos_url":"https://api.github.com/users/lasley/repos","events_url":"https://api.github.com/users/lasley/events{/privacy}","received_events_url":"https://api.github.com/users/lasley/received_events","type":"User","site_admin":false},"body":"Hmmm ok looking at the intent here, we may not want a Savepoint. It's not immediately committing the transaction, and will roll back entirely if another transaction afterwards fails (assuming that transaction is also not within a savepoint). \r\n\r\nThink of it like a save-guard - if the transaction within the Savepoint fails, it will rollback just within that savepoint. If the transaction fails outside of a savepoint, all mutations & savepoints in that transaction will fail.\r\n\r\nNote this is a Postgres feature, so it's significantly easier to play with in direct SQL if you're curious. Surprisingly, the [Postgres docs on Savepoint](https://www.postgresql.org/docs/8.1/static/sql-savepoint.html) are pretty nice & [the Odoo implementation](https://github.com/odoo/odoo/blob/fc2e80cb4bcc450762c7ac5cb82a3e2d88062b38/odoo/sql_db.py#L396) matches nicely.\r\n\r\nWhere is the exclusive lock that is mentioned in the comments actually created?","created_at":"2016-10-13T10:38:08Z","updated_at":"2016-10-13T10:38:08Z","html_url":"https://github.com/OCA/social/pull/97#discussion_r83187987","pull_request_url":"https://api.github.com/repos/OCA/social/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/OCA/social/pulls/comments/83187987"},"html":{"href":"https://github.com/OCA/social/pull/97#discussion_r83187987"},"pull_request":{"href":"https://api.github.com/repos/OCA/social/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/social/pulls/97","id":88845683,"html_url":"https://github.com/OCA/social/pull/97","diff_url":"https://github.com/OCA/social/pull/97.diff","patch_url":"https://github.com/OCA/social/pull/97.patch","issue_url":"https://api.github.com/repos/OCA/social/issues/97","number":97,"state":"open","locked":false,"title":"[8.0][IMP] Performance issues in mail_tracking addons","user":{"login":"antespi","id":1881111,"avatar_url":"https://avatars.githubusercontent.com/u/1881111?v=3","gravatar_id":"","url":"https://api.github.com/users/antespi","html_url":"https://github.com/antespi","followers_url":"https://api.github.com/users/antespi/followers","following_url":"https://api.github.com/users/antespi/following{/other_user}","gists_url":"https://api.github.com/users/antespi/gists{/gist_id}","starred_url":"https://api.github.com/users/antespi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antespi/subscriptions","organizations_url":"https://api.github.com/users/antespi/orgs","repos_url":"https://api.github.com/users/antespi/repos","events_url":"https://api.github.com/users/antespi/events{/privacy}","received_events_url":"https://api.github.com/users/antespi/received_events","type":"User","site_admin":false},"body":"This PR fix some performance issues:\r\n* [Fixed] In some cases ```self.env.cr``` is not closed properly.\r\n* Add ```index=True``` to ```time``` and ```recipient_address``` fields of ```mail.tracking.email``` model\r\n* Many2many relation between partners (and mail contacts) and mail tracking emails deleted\r\n* ```email_score``` is now a non-stored computed field\r\n\r\nAlso includes some new features for processing bounced emails easier:\r\n* Adds a menu for listing mass mailing emails and events\r\n* Add a boolean field ```email_bounced``` to partners and mail contacts. To easy filter them and do manual operations: call the partner, remove the partner, opt-out, ... Also prepare easy inherited methods for programming automatic operations in customer addon.\r\n\r\n\r\n\r\n","created_at":"2016-10-11T14:42:42Z","updated_at":"2016-10-13T10:38:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4d467b073404009289efd15b096a39ee93a269f","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/OCA/social/milestones/2","html_url":"https://github.com/OCA/social/milestones/8.0","labels_url":"https://api.github.com/repos/OCA/social/milestones/2/labels","id":1421730,"number":2,"title":"8.0","description":"","creator":{"login":"hbrunn","id":2563186,"avatar_url":"https://avatars.githubusercontent.com/u/2563186?v=3","gravatar_id":"","url":"https://api.github.com/users/hbrunn","html_url":"https://github.com/hbrunn","followers_url":"https://api.github.com/users/hbrunn/followers","following_url":"https://api.github.com/users/hbrunn/following{/other_user}","gists_url":"https://api.github.com/users/hbrunn/gists{/gist_id}","starred_url":"https://api.github.com/users/hbrunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hbrunn/subscriptions","organizations_url":"https://api.github.com/users/hbrunn/orgs","repos_url":"https://api.github.com/users/hbrunn/repos","events_url":"https://api.github.com/users/hbrunn/events{/privacy}","received_events_url":"https://api.github.com/users/hbrunn/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":34,"state":"open","created_at":"2015-11-20T13:43:12Z","updated_at":"2016-10-13T10:27:04Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/OCA/social/pulls/97/commits","review_comments_url":"https://api.github.com/repos/OCA/social/pulls/97/comments","review_comment_url":"https://api.github.com/repos/OCA/social/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/social/issues/97/comments","statuses_url":"https://api.github.com/repos/OCA/social/statuses/2afe69c958d72c49027e603d2b563d316ea9eb86","head":{"label":"Tecnativa:8.0-mail_tracking_performance","ref":"8.0-mail_tracking_performance","sha":"2afe69c958d72c49027e603d2b563d316ea9eb86","user":{"login":"Tecnativa","id":18120193,"avatar_url":"https://avatars.githubusercontent.com/u/18120193?v=3","gravatar_id":"","url":"https://api.github.com/users/Tecnativa","html_url":"https://github.com/Tecnativa","followers_url":"https://api.github.com/users/Tecnativa/followers","following_url":"https://api.github.com/users/Tecnativa/following{/other_user}","gists_url":"https://api.github.com/users/Tecnativa/gists{/gist_id}","starred_url":"https://api.github.com/users/Tecnativa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tecnativa/subscriptions","organizations_url":"https://api.github.com/users/Tecnativa/orgs","repos_url":"https://api.github.com/users/Tecnativa/repos","events_url":"https://api.github.com/users/Tecnativa/events{/privacy}","received_events_url":"https://api.github.com/users/Tecnativa/received_events","type":"Organization","site_admin":false},"repo":{"id":57903102,"name":"social","full_name":"Tecnativa/social","owner":{"login":"Tecnativa","id":18120193,"avatar_url":"https://avatars.githubusercontent.com/u/18120193?v=3","gravatar_id":"","url":"https://api.github.com/users/Tecnativa","html_url":"https://github.com/Tecnativa","followers_url":"https://api.github.com/users/Tecnativa/followers","following_url":"https://api.github.com/users/Tecnativa/following{/other_user}","gists_url":"https://api.github.com/users/Tecnativa/gists{/gist_id}","starred_url":"https://api.github.com/users/Tecnativa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tecnativa/subscriptions","organizations_url":"https://api.github.com/users/Tecnativa/orgs","repos_url":"https://api.github.com/users/Tecnativa/repos","events_url":"https://api.github.com/users/Tecnativa/events{/privacy}","received_events_url":"https://api.github.com/users/Tecnativa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Tecnativa/social","description":"Addons concerning odoo's social ERP features and messaging in general","fork":true,"url":"https://api.github.com/repos/Tecnativa/social","forks_url":"https://api.github.com/repos/Tecnativa/social/forks","keys_url":"https://api.github.com/repos/Tecnativa/social/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tecnativa/social/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tecnativa/social/teams","hooks_url":"https://api.github.com/repos/Tecnativa/social/hooks","issue_events_url":"https://api.github.com/repos/Tecnativa/social/issues/events{/number}","events_url":"https://api.github.com/repos/Tecnativa/social/events","assignees_url":"https://api.github.com/repos/Tecnativa/social/assignees{/user}","branches_url":"https://api.github.com/repos/Tecnativa/social/branches{/branch}","tags_url":"https://api.github.com/repos/Tecnativa/social/tags","blobs_url":"https://api.github.com/repos/Tecnativa/social/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tecnativa/social/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tecnativa/social/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tecnativa/social/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tecnativa/social/statuses/{sha}","languages_url":"https://api.github.com/repos/Tecnativa/social/languages","stargazers_url":"https://api.github.com/repos/Tecnativa/social/stargazers","contributors_url":"https://api.github.com/repos/Tecnativa/social/contributors","subscribers_url":"https://api.github.com/repos/Tecnativa/social/subscribers","subscription_url":"https://api.github.com/repos/Tecnativa/social/subscription","commits_url":"https://api.github.com/repos/Tecnativa/social/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tecnativa/social/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tecnativa/social/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tecnativa/social/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tecnativa/social/contents/{+path}","compare_url":"https://api.github.com/repos/Tecnativa/social/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tecnativa/social/merges","archive_url":"https://api.github.com/repos/Tecnativa/social/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tecnativa/social/downloads","issues_url":"https://api.github.com/repos/Tecnativa/social/issues{/number}","pulls_url":"https://api.github.com/repos/Tecnativa/social/pulls{/number}","milestones_url":"https://api.github.com/repos/Tecnativa/social/milestones{/number}","notifications_url":"https://api.github.com/repos/Tecnativa/social/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tecnativa/social/labels{/name}","releases_url":"https://api.github.com/repos/Tecnativa/social/releases{/id}","deployments_url":"https://api.github.com/repos/Tecnativa/social/deployments","created_at":"2016-05-02T16:15:37Z","updated_at":"2016-05-02T16:15:38Z","pushed_at":"2016-10-13T10:35:29Z","git_url":"git://github.com/Tecnativa/social.git","ssh_url":"git@github.com:Tecnativa/social.git","clone_url":"https://github.com/Tecnativa/social.git","svn_url":"https://github.com/Tecnativa/social","homepage":"https://odoo-community.org/project/99","size":1641,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"9.0"}},"base":{"label":"OCA:8.0","ref":"8.0","sha":"c6588471ab61236e404f7c25d254655cae85c1e5","user":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"repo":{"id":39009740,"name":"social","full_name":"OCA/social","owner":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OCA/social","description":"Addons concerning odoo's social ERP features and messaging in general","fork":false,"url":"https://api.github.com/repos/OCA/social","forks_url":"https://api.github.com/repos/OCA/social/forks","keys_url":"https://api.github.com/repos/OCA/social/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/social/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/social/teams","hooks_url":"https://api.github.com/repos/OCA/social/hooks","issue_events_url":"https://api.github.com/repos/OCA/social/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/social/events","assignees_url":"https://api.github.com/repos/OCA/social/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/social/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/social/tags","blobs_url":"https://api.github.com/repos/OCA/social/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/social/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/social/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/social/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/social/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/social/languages","stargazers_url":"https://api.github.com/repos/OCA/social/stargazers","contributors_url":"https://api.github.com/repos/OCA/social/contributors","subscribers_url":"https://api.github.com/repos/OCA/social/subscribers","subscription_url":"https://api.github.com/repos/OCA/social/subscription","commits_url":"https://api.github.com/repos/OCA/social/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/social/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/social/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/social/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/social/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/social/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/social/merges","archive_url":"https://api.github.com/repos/OCA/social/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/social/downloads","issues_url":"https://api.github.com/repos/OCA/social/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/social/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/social/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/social/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/social/labels{/name}","releases_url":"https://api.github.com/repos/OCA/social/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/social/deployments","created_at":"2015-07-13T12:06:47Z","updated_at":"2016-10-08T13:00:03Z","pushed_at":"2016-10-13T10:36:59Z","git_url":"git://github.com/OCA/social.git","ssh_url":"git@github.com:OCA/social.git","clone_url":"https://github.com/OCA/social.git","svn_url":"https://github.com/OCA/social","homepage":"https://odoo-community.org/project/99","size":2023,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":15,"forks":66,"open_issues":15,"watchers":12,"default_branch":"10.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/social/pulls/97"},"html":{"href":"https://github.com/OCA/social/pull/97"},"issue":{"href":"https://api.github.com/repos/OCA/social/issues/97"},"comments":{"href":"https://api.github.com/repos/OCA/social/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/social/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/social/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/social/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/social/statuses/2afe69c958d72c49027e603d2b563d316ea9eb86"}}}}
{"actor":{"display_login":"lasley"}}