Skip to content

Commit

Permalink
add queue for usage reports
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelmsmith committed Jan 30, 2024
1 parent b707bf0 commit b6f4772
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/celery-queues.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Important: Add new queues to make Celery consume tasks from them.

# NOTE: Keep in sync with posthog/tasks/utils.py
CELERY_WORKER_QUEUES=celery,stats,email,insight_export,insight_refresh,analytics_queries,exports,subscription_delivery
CELERY_WORKER_QUEUES=celery,stats,email,insight_export,insight_refresh,analytics_queries,exports,subscription_delivery,usage_reports
2 changes: 1 addition & 1 deletion posthog/tasks/scheduled.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def setup_periodic_tasks(sender: Celery, **kwargs: Any) -> None:
sender.add_periodic_task(
crontab(hour="2", minute="15", day_of_week="mon"),
send_org_usage_reports.s(),
name="send instance usage report",
name="send instance usage report, monday",
)
sender.add_periodic_task(
crontab(hour="0", minute="15", day_of_week="tue,wed,thu,fri,sat,sun"),
Expand Down
2 changes: 1 addition & 1 deletion posthog/tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def clickhouse_mark_all_materialized() -> None:
mark_all_materialized()


@shared_task(ignore_result=True)
@shared_task(ignore_result=True, queue=CeleryQueue.USAGE_REPORTS)
def send_org_usage_reports() -> None:
from posthog.tasks.usage_report import send_all_org_usage_reports

Expand Down
1 change: 1 addition & 0 deletions posthog/tasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ class CeleryQueue:
ANALYTICS_QUERIES = "analytics_queries"
EXPORTS = "exports"
SUBSCRIPTION_DELIVERY = "subscription_delivery"
USAGE_REPORTS = "usage_reports"

0 comments on commit b6f4772

Please sign in to comment.