How and When Generate the Order File

I wonder how you would approach this particular problem.

Let’s assume you are a customer of a bakery.
You can sign in with your account and create an order.
Once you have submitted the order, it appears somewhere in your account under the tab “My Orders”.
You can edit the order e.g. add/remove items unless a certain hour (deadline) has passed. Once it has passed, we need to create a CSV file for each and every order because this system talks to another system, which collects them at a particular time.
Every user receives a notification e-mail after the deadline.

Would it be a terrible idea to just create a CSV file right after the order was submitted and edit/delete it based on future user’s actions?
I feel like this is a bit clumsy though, probably the right way to do it is to setup a CRON for this kind of stuff. But what if we talk about creating 1 000 files? 10 000? 100 000? It’ll take a while.

A system collects the csv files at a particular time, lets say xx:yy hrs. So, it is possible to create csv files, in a batch, before that time, xx:yy, and then process the csv. A batch process creates the csv files for orders that have reached the deadline.

I guess, you may have to work with what is your immediate need, regarding the number of csv files to be processed. Optionally, instead of a file for each order, it may be possible that you can put all orders to be processed in a single csv file.

Thanks for the feedback!

I also think that this is one the best options.
Even if I decided to create/edit/delete orders “on-the-fly”, I would have to set up a CRON that would send e-mails.

The idea of creating a single CSV file is intriguing, too. Though, in this case, it’ll probably be better to go with individual files.

Yes, sending the emails can be processed along with the batch job, i.e., along with creating the csv files.