In this episode, we tackle marking an import as complete after it's processed. The process is pretty similar to how we handled exports, so if you've been following along, it should feel familiar! We'll set up a job that gets queued up after the import has run through all the sheets and rows and inserted them into the database.
First, we create a new job (called MarkImportComplete
) that receives the import, and all it really needs to do is set the completed_at
timestamp—super simple. We also touch on how you might want to send notifications or chain on other jobs when the import finishes, just like we did for exports.
After setting this up, we give it a test run! We'll clear out the imports and try importing a fresh batch of records to see everything works smoothly. We also handle some UI feedback: after the import, the user is redirected to the imports page, but you can tweak this however you like for your own project.
Finally, to make sure the system scales, we try it out with a larger dataset (10,000 records). We go through the full process: seed the database, export, clear things out, then re-import to make sure big imports are handled fast and efficiently. It all works great—and as you’ll see, even huge CSVs are processed super quickly!