modified for neelay's mysqldb queue