Fix the tests and the one bug that it highlighted.
This commit is contained in:
parent
b619356907
commit
e7064f1191
6 changed files with 53 additions and 24 deletions
|
@ -1,6 +1,10 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
from data.database import QueueItem, db
|
||||
from app import app
|
||||
|
||||
|
||||
transaction_factory = app.config['DB_TRANSACTION_FACTORY']
|
||||
|
||||
|
||||
class WorkQueue(object):
|
||||
|
@ -34,7 +38,7 @@ class WorkQueue(object):
|
|||
available_or_expired = ((QueueItem.available == True) |
|
||||
(QueueItem.processing_expires <= now))
|
||||
|
||||
with db.transaction():
|
||||
with transaction_factory(db):
|
||||
avail = QueueItem.select().where(QueueItem.queue_name == self.queue_name,
|
||||
QueueItem.available_after <= now,
|
||||
available_or_expired,
|
||||
|
|
Reference in a new issue