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

fix: use read replica in cache_test_rollups #877

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tasks/cache_test_rollups.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import datetime as dt

import polars as pl
from django.db import connection
from django.db import connections
from redis.exceptions import LockError
from shared.celery_config import cache_test_rollups_task_name
from shared.config import get_config

from app import celery_app
from services.redis import get_redis_connection
Expand Down Expand Up @@ -104,6 +105,11 @@
def run_impl_within_lock(self, repoid, branch):
storage_service = get_storage_client()

if get_config("setup", "database", "read_replica_enabled", default=False):
connection = connections["default_read"]

Check warning on line 109 in tasks/cache_test_rollups.py

View check run for this annotation

Codecov Notifications / codecov/patch

tasks/cache_test_rollups.py#L109

Added line #L109 was not covered by tests
else:
connection = connections["default"]

with connection.cursor() as cursor:
for interval_start, interval_end in [
(1, None),
Expand Down
Loading