Creating a processing queue in python
<p>I have an email account set up that triggers a python script whenever it receives an email.  The script goes through several functions which can take about 30 seconds and writes an entry into a MYSQL database.</p>

<p>Everything runs smoothly until a second email is sent in less than 30 seconds after the first.  The second email is processed correctly, but the first email creates a corrupted entry into the database.</p>

<p>I'm looking to hold the email data,</p>

<pre><code>msg=email.message_from_file(sys.stdin)
</code></pre>

<p>in a queue if the script has not finished processing the prior email.</p>

<p>I'm using python 2.5.
Can anyone recommend a package/script that would accomplish this?</p>
