Skip to content

Commit

Permalink
fix: Only send an email in non-retryable failures
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Apr 17, 2024
1 parent ca25d09 commit abb196a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions posthog/temporal/batch_exports/batch_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,14 @@ async def finish_batch_export_run(inputs: FinishBatchExportRunInputs) -> None:

if batch_export_run.status in (BatchExportRun.Status.FAILED, BatchExportRun.Status.FAILED_RETRYABLE):
logger.error("Batch export failed with error: %s", batch_export_run.latest_error)
from posthog.tasks.email import send_batch_export_run_failure

try:
await send_batch_export_run_failure(inputs.id)
except Exception:
logger.exception("Failure email notification could not be sent")
if batch_export_run.status == BatchExportRun.Status.FAILED:
from posthog.tasks.email import send_batch_export_run_failure

try:
await send_batch_export_run_failure(inputs.id)
except Exception:
logger.exception("Failure email notification could not be sent")

elif batch_export_run.status == BatchExportRun.Status.CANCELLED:
logger.warning("BatchExport was cancelled.")
Expand Down

0 comments on commit abb196a

Please sign in to comment.