Threading and it is more of a ruby question, than a rails question

I needed an email queueing system for a project I am writing. The script below runs every minute via a cronjob on one of my servers. I am using a table in mysql to keep track of the number of email bot threads to spawn and their current state. They need to be threaded(or at least run concurrently) since some email lists will be longer than others, and some emails have a higher priority. The thought is that this way I can quickly add more email threads as is needed, as well as have a simple web ui to check their state and turn them on or off as is necessary.

It works perfectly, most of the time. But sometime, arbitrarily, one of the threads does not finish and an email bot state is left as processing. In the log file, it actually says that it completes, but the entry in the database still says processing. Any ideas?

======== Email Bots Table ===========

Actually looking it is terminating when i call after finishing walking through all of the sends