In this episode, we dive into enhancing our export process by marking exports as complete once they've finished processing. We start by looking at how we're using job queues and how we can chain additional jobs to run after the export job completes.
We implement a custom job called MarkExportComplete
that updates the completed_at
column in the database for the finished export. This involves passing the export model into the job, updating the completed_at
timestamp, and making sure our model casts this column as a datetime
.
To verify everything works, we run an export of a handful of records and then check the database to confirm that the completed_at
column is being properly filled in when the export finishes. This sets us up nicely for future episodes, where we'll use this column to display the status of exports and even trigger email notifications to users when their exports are done.
Stay tuned for the next episode, where we'll add another job to the chain to email the user when an export completes!