Skip to content

Commit

Permalink
chore(batch-exports): Add memory cap to buffer queue
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Oct 16, 2024
1 parent c30c1df commit 20bba96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions posthog/settings/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
BATCH_EXPORT_BIGQUERY_UPLOAD_CHUNK_SIZE_BYTES: int = 1024 * 1024 * 100 # 100MB
BATCH_EXPORT_HTTP_UPLOAD_CHUNK_SIZE_BYTES: int = 1024 * 1024 * 50 # 50MB
BATCH_EXPORT_HTTP_BATCH_SIZE: int = 5000
BATCH_EXPORT_BUFFER_QUEUE_MAX_SIZE_BYTES: int = 1024 * 1024 * 300 # 300MB

UNCONSTRAINED_TIMESTAMP_TEAM_IDS: list[str] = get_list(os.getenv("UNCONSTRAINED_TIMESTAMP_TEAM_IDS", ""))
ASYNC_ARROW_STREAMING_TEAM_IDS: list[str] = get_list(os.getenv("ASYNC_ARROW_STREAMING_TEAM_IDS", ""))
Expand Down
2 changes: 1 addition & 1 deletion posthog/temporal/batch_exports/batch_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def start_produce_batch_export_record_batches(
extra_query_parameters = parameters.pop("extra_query_parameters") or {}
parameters = {**parameters, **extra_query_parameters}

queue = RecordBatchQueue()
queue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_BUFFER_QUEUE_MAX_SIZE_BYTES)
query_id = uuid.uuid4()
done_event = asyncio.Event()
produce_task = asyncio.create_task(
Expand Down

0 comments on commit 20bba96

Please sign in to comment.