Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(celery): move verify_and_fix_team_metadata_cache_task to FEATURE_FLAGS_LONG_RUNNING queue (#83533)

Asheesh Kumar00829029caf1
diff --git a/posthog/tasks/hypercache_verification.py b/posthog/tasks/hypercache_verification.py
index 6354fdd4717e..57aee230019d 100644
--- a/posthog/tasks/hypercache_verification.py
+++ b/posthog/tasks/hypercache_verification.py
@@ -230,7 +230,7 @@ def verify_and_fix_flags_cache_task(self: PushGatewayTask) -> None:
base=PushGatewayTask,
ignore_result=True,
name=VERIFY_TEAM_METADATA_CACHE_TASK_NAME,
- queue=CeleryQueue.DEFAULT.value,
+ queue=CeleryQueue.FEATURE_FLAGS_LONG_RUNNING.value,
soft_time_limit=20 * 60, # 20 min soft limit
time_limit=25 * 60, # 25 min hard limit (matches LOCK_TIMEOUT_SECONDS)
)
diff --git a/posthog/tasks/test/test_hypercache_verification.py b/posthog/tasks/test/test_hypercache_verification.py
index b2bf930b5d94..13811110d43a 100644
--- a/posthog/tasks/test/test_hypercache_verification.py
+++ b/posthog/tasks/test/test_hypercache_verification.py
@@ -22,6 +22,7 @@ from posthog.tasks.hypercache_verification import (
verify_and_fix_team_metadata_cache_task,
)
from posthog.tasks.test.utils import PushGatewayTaskTestMixin
+from posthog.tasks.utils import CeleryQueue
def _incomplete_runs(cache_type: str, reason: str) -> float:
@@ -177,6 +178,11 @@ class TestVerifyAndFixTeamMetadataCacheTask(PushGatewayTaskTestMixin, TestCase):
assert success == 1
assert duration is not None and duration >= 0
+ def test_runs_on_feature_flags_long_running_queue(self) -> None:
+ # Ensure the task is on FEATURE_FLAGS_LONG_RUNNING, not DEFAULT, to avoid
+ # expiry-based starvation on the shared DEFAULT queue.
+ assert verify_and_fix_team_metadata_cache_task.queue == CeleryQueue.FEATURE_FLAGS_LONG_RUNNING.value
+
@override_settings(FLAGS_REDIS_URL=None)
class TestVerifyAndFixTeamMetadataCacheTaskDisabled(TestCase):