Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor custom app routing #28099

Merged
merged 1 commit into from
Jul 21, 2020
Merged

refactor custom app routing #28099

merged 1 commit into from
Jul 21, 2020

Conversation

snopoke
Copy link
Contributor

@snopoke snopoke commented Jul 13, 2020

SUMMARY

Refactor app custom app routing to be defined in settings

related localsettings change: dimagi/commcare-cloud#3972

@snopoke snopoke added the product/invisible Change has no end-user visible impact label Jul 13, 2020

# map to reporting DB alias
with override_settings(CUSTOM_DB_ROUTING={'custom_app': 'icds-ucr-citus'}), \
override_engine('icds-ucr-citus', '', db_alias='icds-ucr'):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E127 continuation line over-indented for visual indent

# map to reporting DB alias
with override_settings(CUSTOM_DB_ROUTING={'custom_app': 'icds-ucr-citus'}), \
override_engine('icds-ucr-citus', '', db_alias='icds-ucr'):
self.assertIs(False, allow_migrate(DEFAULT_DB_ALIAS, 'custom_app'))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E117 over-indented


AAA_DB_ENGINE_ID = 'aaa-data'

def get_aaa_db_alias():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

elif app_label == AAA_APP:
engine_id = AAA_DB_ENGINE_ID
if not write:
return connection_manager.get_load_balanced_read_db_alias(AAA_DB_ENGINE_ID)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this load balancing is removed but it's not active on any environment anyway. I think the original code was just copied from the ICDS code at the time.

@snopoke snopoke added the Open for review: do not merge A work in progress label Jul 20, 2020
@snopoke snopoke requested a review from esoergel July 20, 2020 13:45
@snopoke
Copy link
Contributor Author

snopoke commented Jul 20, 2020

This is now love on icds-staging env

@@ -1396,6 +1398,13 @@
if 'corehq.sql_db.routers.MultiDBRouter' not in DATABASE_ROUTERS:
DATABASE_ROUTERS.append('corehq.sql_db.routers.MultiDBRouter')

# Mapping of app_label to DB name or reporting DB alias (see REPORTING_DATABASES)
CUSTOM_DB_ROUTING = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the plan to do this via commcare-cloud setting override?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snopoke snopoke removed the Open for review: do not merge A work in progress label Jul 21, 2020
@snopoke snopoke merged commit fb3280e into master Jul 21, 2020
@snopoke snopoke deleted the sk/custom-app-routing branch July 21, 2020 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/invisible Change has no end-user visible impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants