Skip to content

Commit

Permalink
chore(batch-exports): Add comment about flushing
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Oct 17, 2024
1 parent 20bba96 commit f577012
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion posthog/temporal/batch_exports/bigquery_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,10 @@ async def consume_batch_export_record_batches(
if done_event.is_set():
await logger.adebug("Empty queue with no more events being produced, closing writer loop")
flush_start_event.set()
# Exit context manager to trigger flush
break
else:
await asyncio.sleep(1)
await asyncio.sleep(0.1)
continue

record_batch = cast_record_batch_json_columns(record_batch, json_columns=json_columns)
Expand All @@ -606,6 +607,7 @@ async def consume_batch_export_record_batches(
if writer.should_flush():
await logger.adebug("Writer finished, ready to flush events")
flush_start_event.set()
# Exit context manager to trigger flush
break

await logger.adebug("Completed %s records", writer.records_total)
Expand Down

0 comments on commit f577012

Please sign in to comment.