Skip to content

Commit

Permalink
fix: move task to new queue (#23313)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Jun 28, 2024
1 parent 9a30b10 commit c990968
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
10 changes: 2 additions & 8 deletions posthog/tasks/scheduled.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ def setup_periodic_tasks(sender: Celery, **kwargs: Any) -> None:
name="process scheduled changes",
)

add_periodic_task_with_expiry(sender, 3600, invalid_web_replays.s())

if clear_clickhouse_crontab := get_crontab(settings.CLEAR_CLICKHOUSE_REMOVED_DATA_SCHEDULE_CRON):
sender.add_periodic_task(
clear_clickhouse_crontab,
Expand Down Expand Up @@ -314,14 +316,6 @@ def setup_periodic_tasks(sender: Celery, **kwargs: Any) -> None:
check_data_import_row_limits.s(),
name="check external data rows synced",
)

add_periodic_task_with_expiry(
sender,
3600,
invalid_web_replays.s(),
name="Invalid web replays count",
)

# Every 20 minutes try to retrieve and calculate total rows synced in period

sender.add_periodic_task(
Expand Down
4 changes: 3 additions & 1 deletion posthog/tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ def ingestion_lag() -> None:
pass


@shared_task(ignore_result=True)
@shared_task(ignore_result=True, queue=CeleryQueue.SESSION_REPLAY_GENERAL.value)
def invalid_web_replays() -> None:
logger.info("[invalid web replays] running task")

from posthog.client import sync_execute

# ultimately I want to observe values by team id, but at the moment that would be lots of series, let's reduce the value first
Expand Down
1 change: 1 addition & 0 deletions posthog/tasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ class CeleryQueue(Enum):
USAGE_REPORTS = "usage_reports"
SESSION_REPLAY_EMBEDDINGS = "session_replay_embeddings"
SESSION_REPLAY_PERSISTENCE = "session_replay_persistence"
SESSION_REPLAY_GENERAL = "session_replay_general"

0 comments on commit c990968

Please sign in to comment.