Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit e6e0551

Browse files
authored
Use cache instance directly from shared (#1266)
1 parent 3f4c391 commit e6e0551

File tree

31 files changed

+33
-71
lines changed

31 files changed

+33
-71
lines changed

api/internal/feature/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from rest_framework.response import Response
88
from rest_framework.views import APIView
99
from shared.django_apps.rollouts.models import FeatureFlag
10+
from shared.helpers.redis import get_redis_connection
1011
from shared.rollouts import Feature
1112

1213
from api.internal.feature.helpers import get_flag_cache_redis_key, get_identifier
13-
from services.redis_configuration import get_redis_connection
1414
from utils.config import get_config
1515

1616
from .serializers import FeatureRequestSerializer

codecov_auth/commands/owner/interactors/get_uploads_number_per_user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from typing import Optional
22

33
from asgiref.sync import sync_to_async
4+
from shared.helpers.redis import get_redis_connection
45
from shared.plan.service import PlanService
56
from shared.upload.utils import query_monthly_coverage_measurements
67

78
from codecov.commands.base import BaseInteractor
89
from codecov_auth.models import Owner
9-
from services.redis_configuration import get_redis_connection
1010

1111
redis = get_redis_connection()
1212

codecov_auth/views/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
from django.utils.timezone import now
1717
from shared.encryption.token import encode_token
1818
from shared.events.amplitude import AmplitudeEventPublisher
19+
from shared.helpers.redis import get_redis_connection
1920
from shared.license import LICENSE_ERRORS_MESSAGES, get_current_license
2021

2122
from codecov_auth.models import Owner, OwnerProfile, Session, User
2223
from services.analytics import AnalyticsService
23-
from services.redis_configuration import get_redis_connection
2424
from services.refresh import RefreshService
2525
from utils.config import get_config
2626
from utils.encryption import encryptor

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def codecov_vcr(request):
4242

4343
@pytest.fixture
4444
def mock_redis(mocker):
45-
m = mocker.patch("services.redis_configuration._get_redis_instance_from_url")
45+
m = mocker.patch("shared.helpers.redis._get_redis_instance_from_url")
4646
redis_server = fakeredis.FakeStrictRedis()
4747
m.return_value = redis_server
4848
yield redis_server

core/apps.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import logging
22

33
from django.apps import AppConfig
4-
from shared.helpers.cache import RedisBackend
4+
from shared.helpers.cache import RedisBackend, cache
5+
from shared.helpers.redis import get_redis_connection
56

6-
from services.redis_configuration import get_redis_connection
7-
from utils.cache import cache
87
from utils.config import RUN_ENV
98

109
logger = logging.getLogger(__name__)

core/management/commands/delete_rate_limit_keys.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from django.core.management.base import BaseCommand, CommandParser
2-
3-
from services.redis_configuration import get_redis_connection
2+
from shared.helpers.redis import get_redis_connection
43

54

65
class Command(BaseCommand):

core/tests/test_management_commands.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
from shared.config import ConfigHelper
1010
from shared.django_apps.codecov_auth.models import Plan, Tier
1111
from shared.django_apps.core.tests.factories import OwnerFactory, RepositoryFactory
12-
13-
from services.redis_configuration import get_redis_connection
12+
from shared.helpers.redis import get_redis_connection
1413

1514

1615
@pytest.mark.django_db

graphql_api/tests/test_test_analytics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77
from shared.django_apps.codecov_auth.tests.factories import OwnerFactory
88
from shared.django_apps.core.tests.factories import RepositoryFactory
9+
from shared.helpers.redis import get_redis_connection
910
from shared.storage.exceptions import BucketAlreadyExistsError
1011
from shared.storage.memory import MemoryStorageService
1112

@@ -20,7 +21,6 @@
2021
generate_test_results,
2122
get_results,
2223
)
23-
from services.redis_configuration import get_redis_connection
2424
from utils.test_results import dedup_table
2525

2626
from .helper import GraphQLTestHelper

graphql_api/types/owner/owner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from asgiref.sync import sync_to_async
1111
from django.conf import settings
1212
from graphql import GraphQLResolveInfo
13+
from shared.helpers.redis import get_redis_connection
1314
from shared.plan.constants import DEFAULT_FREE_PLAN
1415
from shared.plan.service import PlanService
1516

@@ -43,7 +44,6 @@
4344
from graphql_api.types.errors.errors import NotFoundError
4445
from graphql_api.types.repository.repository import TOKEN_UNAVAILABLE
4546
from services.billing import BillingService
46-
from services.redis_configuration import get_redis_connection
4747
from timeseries.helpers import fill_sparse_measurements
4848
from timeseries.models import Interval
4949
from utils.config import get_config

graphql_api/types/repository/repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from asgiref.sync import sync_to_async
1010
from django.conf import settings
1111
from graphql.type.definition import GraphQLResolveInfo
12+
from shared.helpers.redis import get_redis_connection
1213

1314
from codecov_auth.models import SERVICE_GITHUB, SERVICE_GITHUB_ENTERPRISE, Owner
1415
from core.models import Branch, Commit, Pull, Repository
@@ -22,7 +23,6 @@
2223
from graphql_api.types.enums import OrderingDirection
2324
from graphql_api.types.enums.enum_types import PullRequestState
2425
from graphql_api.types.errors.errors import NotFoundError, OwnerNotActivatedError
25-
from services.redis_configuration import get_redis_connection
2626

2727
TOKEN_UNAVAILABLE = "Token Unavailable. Please contact your admin."
2828

0 commit comments

Comments
 (0)