Skip to content

Commit

Permalink
feat(batch-exports): Send file write to thread (#24792)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias authored Sep 4, 2024
1 parent 025f019 commit 73fce74
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion posthog/temporal/batch_exports/temporary_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module contains a temporary file to stage data in batch exports."""

import abc
import asyncio
import collections.abc
import contextlib
import csv
Expand Down Expand Up @@ -390,7 +391,7 @@ async def write_record_batch(self, record_batch: pa.RecordBatch) -> None:
column_names = record_batch.column_names
column_names.pop(column_names.index("_inserted_at"))

self._write_record_batch(record_batch.select(column_names))
await asyncio.to_thread(self._write_record_batch, record_batch.select(column_names))

self.last_inserted_at = last_inserted_at
self.track_records_written(record_batch)
Expand Down

0 comments on commit 73fce74

Please sign in to comment.