{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/188466552","pull_request_review_id":120450893,"id":188466552,"diff_hunk":"@@ -78,13 +84,68 @@ def test_read_load_balancing(self):\n                 alias: weight * total_requests // total_weighting\n                 for alias, weight in reporting_dbs['ucr']['READ']\n             }\n-            balanced = Counter(manager.get_load_balanced_read_engine_id('ucr') for i in range(total_requests))\n+            balanced = Counter(manager.get_load_balanced_read_db_alais('ucr') for i in range(total_requests))\n             for db, requests in balanced.items():\n                 self.assertAlmostEqual(requests, expected[db], delta=randomness_margin)\n \n         with override_settings(REPORTING_DATABASES={'default': 'default'}):\n             manager = ConnectionManager()\n             self.assertEqual(\n                 ['default', 'default', 'default'],\n-                [manager.get_load_balanced_read_engine_id('default') for i in range(3)]\n+                [manager.get_load_balanced_read_db_alais('default') for i in range(3)]\n+            )\n+\n+    @mock.patch('corehq.sql_db.util.get_replication_delay_for_standby', lambda x: {'ucr': 4}.get(x, 0))\n+    def test_standby_filtering(self, *args):\n+        reporting_dbs = {\n+            'ucr_engine': {\n+                'WRITE': 'ucr',\n+                'READ': [('ucr', 8), ('other', 1)]\n+            },\n+        }\n+        with override_settings(REPORTING_DATABASES=reporting_dbs):\n+            # should always return the `other` db since `ucr` has bad replication delay\n+            manager = ConnectionManager()\n+            self.assertEqual(\n+                ['other', 'other', 'other'],\n+                [manager.get_load_balanced_read_db_alais('ucr_engine') for i in range(3)]\n+            )\n+\n+    @mock.patch('corehq.sql_db.util.get_replication_delay_for_standby', return_value=0)\n+    def test_load_balanced_read_apps(self, mock):\n+        load_balanced_apps = {\n+            'users': [\n+                ('users_db1', 5),\n+            ]\n+        }\n+\n+        with override_settings(\n+            LOAD_BALANCED_APPS=load_balanced_apps,\n+            DATABASES = {","path":"corehq/sql_db/tests/test_connections.py","position":85,"original_position":85,"commit_id":"ab137ffbec4490e32e4666e4d95ded16cde2fb0e","original_commit_id":"ab137ffbec4490e32e4666e4d95ded16cde2fb0e","user":{"login":"stickler-ci","id":16011037,"avatar_url":"https://avatars3.githubusercontent.com/u/16011037?v=4","gravatar_id":"","url":"https://api.github.com/users/stickler-ci","html_url":"https://github.com/stickler-ci","followers_url":"https://api.github.com/users/stickler-ci/followers","following_url":"https://api.github.com/users/stickler-ci/following{/other_user}","gists_url":"https://api.github.com/users/stickler-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/stickler-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stickler-ci/subscriptions","organizations_url":"https://api.github.com/users/stickler-ci/orgs","repos_url":"https://api.github.com/users/stickler-ci/repos","events_url":"https://api.github.com/users/stickler-ci/events{/privacy}","received_events_url":"https://api.github.com/users/stickler-ci/received_events","type":"User","site_admin":false},"body":"E251 unexpected spaces around keyword / parameter equals","created_at":"2018-05-15T23:31:51Z","updated_at":"2018-05-15T23:31:52Z","html_url":"https://github.com/dimagi/commcare-hq/pull/20540#discussion_r188466552","pull_request_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/188466552"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/20540#discussion_r188466552"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540","id":187832503,"html_url":"https://github.com/dimagi/commcare-hq/pull/20540","diff_url":"https://github.com/dimagi/commcare-hq/pull/20540.diff","patch_url":"https://github.com/dimagi/commcare-hq/pull/20540.patch","issue_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/20540","number":20540,"state":"open","locked":false,"title":"Email accounts@ if dimagi contact is blank","user":{"login":"gbova","id":15271571,"avatar_url":"https://avatars0.githubusercontent.com/u/15271571?v=4","gravatar_id":"","url":"https://api.github.com/users/gbova","html_url":"https://github.com/gbova","followers_url":"https://api.github.com/users/gbova/followers","following_url":"https://api.github.com/users/gbova/following{/other_user}","gists_url":"https://api.github.com/users/gbova/gists{/gist_id}","starred_url":"https://api.github.com/users/gbova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbova/subscriptions","organizations_url":"https://api.github.com/users/gbova/orgs","repos_url":"https://api.github.com/users/gbova/repos","events_url":"https://api.github.com/users/gbova/events{/privacy}","received_events_url":"https://api.github.com/users/gbova/received_events","type":"User","site_admin":false},"body":"If there is no dimagi contact, email the invoice to accounts@","created_at":"2018-05-14T13:46:23Z","updated_at":"2018-05-15T23:31:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c059eb9a969dc98be2a13b3908e03c8240a0473d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":724787015,"url":"https://api.github.com/repos/dimagi/commcare-hq/labels/product/invisible","name":"product/invisible","color":"cfd2d6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/20540/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/ab137ffbec4490e32e4666e4d95ded16cde2fb0e","head":{"label":"dimagi:update-implementation-invoice-email","ref":"update-implementation-invoice-email","sha":"ab137ffbec4490e32e4666e4d95ded16cde2fb0e","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-hq/deployments","created_at":"2009-07-09T17:00:07Z","updated_at":"2018-05-15T21:13:06Z","pushed_at":"2018-05-15T23:27:44Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"https://www.commcarehq.org","size":436384,"stargazers_count":92,"watchers_count":92,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":104,"mirror_url":null,"archived":false,"open_issues_count":75,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":104,"open_issues":75,"watchers":92,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"831a31be5184e081adeb93a6c623ddda076e0fdd","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-hq/deployments","created_at":"2009-07-09T17:00:07Z","updated_at":"2018-05-15T21:13:06Z","pushed_at":"2018-05-15T23:27:44Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"https://www.commcarehq.org","size":436384,"stargazers_count":92,"watchers_count":92,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":104,"mirror_url":null,"archived":false,"open_issues_count":75,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":104,"open_issues":75,"watchers":92,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/20540"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/20540"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/20540/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/20540/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare-hq/statuses/ab137ffbec4490e32e4666e4d95ded16cde2fb0e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"stickler-ci"}}