Due to limitations put on me I've got to put my outgoing Email Queue in the same database as my customer information.
What are some optimizations I can make, specifically to the Email portion that will make this process smoother:
- Grab emails where "sending" is set to False
- Set "sending" on all those records to True
- Process them one at a time, if they fail mark "sending" to False on the record
- If they succeed, delete the record and add a new one to "Email Archive" table
This process will run once every 5 minutes. At the moment there will only be one app sending the emails but in the future there may be more.