perf(organizations): cache and instrument API responses
This commit is contained in:
@@ -5,8 +5,8 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
from celery import shared_task
|
||||
from django.core.cache import cache
|
||||
|
||||
from organizations.cache import invalidate_organization_api_cache
|
||||
from organizations.services import OrganizationDataSnapshotRefreshService
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -16,7 +16,7 @@ logger = logging.getLogger(__name__)
|
||||
def refresh_all_organization_data_snapshots(batch_size: int = 100) -> dict:
|
||||
"""Refresh all organization data snapshots for API v2."""
|
||||
result = OrganizationDataSnapshotRefreshService.refresh(batch_size=batch_size)
|
||||
cache.clear()
|
||||
invalidate_organization_api_cache()
|
||||
payload = {
|
||||
"processed": result.processed,
|
||||
"created": result.created,
|
||||
@@ -39,7 +39,7 @@ def refresh_organization_data_snapshots_for_parser_batch(
|
||||
batch_id=batch_id,
|
||||
batch_size=batch_size,
|
||||
)
|
||||
cache.clear()
|
||||
invalidate_organization_api_cache()
|
||||
payload = {
|
||||
"source": source,
|
||||
"batch_id": batch_id,
|
||||
|
||||
Reference in New Issue
Block a user