Skip to content

Commit

Permalink
Fix issue with failed background job emails not being sent (#2187)
Browse files Browse the repository at this point in the history
Fixes #2186 

Background job emails will no longer fail to send for jobs unrelated to
file replication or replica deletion.

Also uses `AnyJob` for paginated background job response model, to fix
typing being out of data following addition of other types of background
jobs and lower overhead for adding new ones moving forward.
  • Loading branch information
tw4l authored Nov 28, 2024
1 parent 292176d commit 661e5d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/btrixcloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ class EmptyResponse(BaseModel):
class PaginatedBackgroundJobResponse(PaginatedResponse):
"""Response model for paginated background jobs"""

items: List[Union[CreateReplicaJob, DeleteReplicaJob]]
items: List[AnyJob]


# ============================================================================
Expand Down
11 changes: 11 additions & 0 deletions chart/email-templates/failed_bg_job
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ Job ID: {{ job.id }}
Started: {{ job.started.isoformat(sep=" ", timespec="seconds") }}Z
Finished: {{ finished.isoformat(sep=" ", timespec="seconds") }}Z

{% if job.object_type %}
Object type: {{ job.object_type }}
{% endif %}

{% if job.object_id %}
Object ID: {{ job.object_id }}
{% endif %}

{% if job.file_path %}
File path: {{ job.file_path }}
{% endif %}

{% if job.replica_storage %}
Replica storage name: {{ job.replica_storage.name }}
{% endif %}

0 comments on commit 661e5d9

Please sign in to comment.